image_media_send_to_editor() – Retrieves the media element HTML to send to the editor.

You appear to be a bot. Output may be restricted

Description

Retrieves the media element HTML to send to the editor.

Usage

$string = image_media_send_to_editor( $html, $attachment_id, $attachment );

Parameters

$html
( string ) required
$attachment_id
( int ) required
$attachment
( array ) required

Returns

string

Source

File name: wordpress/wp-admin/includes/media.php
Lines:

1 to 15 of 15
function image_media_send_to_editor( $html, $attachment_id, $attachment ) {
  $post = get_post( $attachment_id );

  if ( 'image' === substr( $post->post_mime_type, 0, 5 ) ) {
    $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   = ( strpos( $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;
}
 

 View on GitHub View on Trac