Filter hook 'media_send_to_editor'

in WP Core File wp-admin/includes/media.php at line 858

View Source

media_send_to_editor

Filter Hook
Description
Filters the HTML markup for a media item sent to the editor.

Hook Information

File Location wp-admin/includes/media.php View on GitHub
Hook Type Filter
Line Number 858

Hook Parameters

Type Name Description
string $html HTML markup for a media item sent to the editor.
int $send_id The first key from the $_POST['send'] data.
array $attachment Array of attachment metadata.

Usage Examples

Basic Usage
<?php
// Hook into media_send_to_editor
add_filter('media_send_to_editor', 'my_custom_filter', 10, 3);

function my_custom_filter($html, $send_id, $attachment) {
    // Your custom filtering logic here
    return $html;
}

Source Code Context

wp-admin/includes/media.php:858 - How this hook is used in WordPress core
<?php
 853  		 *
 854  		 * @param string $html       HTML markup for a media item sent to the editor.
 855  		 * @param int    $send_id    The first key from the $_POST['send'] data.
 856  		 * @param array  $attachment Array of attachment metadata.
 857  		 */
 858  		$html = apply_filters( 'media_send_to_editor', $html, $send_id, $attachment );
 859  
 860  		return media_send_to_editor( $html );
 861  	}
 862  
 863  	return $errors;

PHP Documentation

<?php
/**
		 * Filters the HTML markup for a media item sent to the editor.
		 *
		 * @since 2.5.0
		 *
		 * @see wp_get_attachment_metadata()
		 *
		 * @param string $html       HTML markup for a media item sent to the editor.
		 * @param int    $send_id    The first key from the $_POST['send'] data.
		 * @param array  $attachment Array of attachment metadata.
		 */
Quick Info
  • Hook Type: Filter
  • Parameters: 3
  • File: wp-admin/includes/media.php
Related Hooks

Related hooks will be displayed here in future updates.