image_send_to_editor
Filter HookDescription
Filters the image HTML markup to send to the editor when inserting an image.Hook Information
File Location |
wp-admin/includes/media.php
View on GitHub
|
Hook Type | Filter |
Line Number | 168 |
Hook Parameters
Type | Name | Description |
---|---|---|
string
|
$html
|
The image HTML markup to send. |
int
|
$id
|
The attachment ID. |
string
|
$caption
|
The image caption. |
string
|
$title
|
The image title. |
string
|
$align
|
The image alignment. |
string
|
$url
|
The image source URL. |
string|int[]
|
$size
|
Requested image size. Can be any registered image size name, or an array of width and height values in pixels (in that order). |
string
|
$alt
|
The image alternative, or alt, text. |
string
|
$rel
|
The image rel attribute. |
Usage Examples
Basic Usage
<?php
// Hook into image_send_to_editor
add_filter('image_send_to_editor', 'my_custom_filter', 10, 9);
function my_custom_filter($html, $id, $caption, $title, $align, $url, $size, $alt, $rel) {
// Your custom filtering logic here
return $html;
}
Source Code Context
wp-admin/includes/media.php:168
- How this hook is used in WordPress core
<?php
163 * @param string|int[] $size Requested image size. Can be any registered image size name, or
164 * an array of width and height values in pixels (in that order).
165 * @param string $alt The image alternative, or alt, text.
166 * @param string $rel The image rel attribute.
167 */
168 $html = apply_filters( 'image_send_to_editor', $html, $id, $caption, $title, $align, $url, $size, $alt, $rel );
169
170 return $html;
171 }
172
173 /**
PHP Documentation
<?php
/**
* Filters the image HTML markup to send to the editor when inserting an image.
*
* @since 2.5.0
* @since 5.6.0 The `$rel` parameter was added.
*
* @param string $html The image HTML markup to send.
* @param int $id The attachment ID.
* @param string $caption The image caption.
* @param string $title The image title.
* @param string $align The image alignment.
* @param string $url The image source URL.
* @param string|int[] $size Requested image size. Can be any registered image size name, or
* an array of width and height values in pixels (in that order).
* @param string $alt The image alternative, or alt, text.
* @param string $rel The image rel attribute.
*/
Quick Info
- Hook Type: Filter
- Parameters: 9
- File: wp-admin/includes/media.php
Related Hooks
Related hooks will be displayed here in future updates.