wpseek.com
Outil de recherche WordPress pour les développeurs et auteurs de thèmes
image_media_send_to_editor › WordPress Function
Depuis2.5.0
Dépréciéen/a
› image_media_send_to_editor ( $html, $attachment_id, $attachment )
| Paramètres: (3) |
|
| Retourne: |
|
| Défini(e) dans: |
|
| Codex: |
Retrieves the media element HTML to send to the editor.
Fonctions en relation: media_send_to_editor, get_image_send_to_editor, image_constrain_size_for_editor, get_real_file_to_edit, wp_ajax_send_link_to_editor
Source
function image_media_send_to_editor( $html, $attachment_id, $attachment ) {
$post = get_post( $attachment_id );
if ( str_starts_with( $post->post_mime_type, 'image' ) ) {
$url = $attachment['url'];
$align = ! empty( $attachment['align'] ) ? $attachment['align'] : 'none';
$size = ! empty( $attachment['image-size'] ) ? $attachment['image-size'] : 'medium';
$alt = ! empty( $attachment['image_alt'] ) ? $attachment['image_alt'] : '';
$rel = ( str_contains( $url, 'attachment_id' ) || get_attachment_link( $attachment_id ) === $url );
return get_image_send_to_editor( $attachment_id, $attachment['post_excerpt'], $attachment['post_title'], $align, $url, $rel, $size, $alt );
}
return $html;
}