wp_content_img_tag хук-фильтрWP 6.0.0

Filters an img tag within the content for a given context.

Использование

add_filter( 'wp_content_img_tag', 'wp_kama_content_img_tag_filter', 10, 3 );

/**
 * Function for `wp_content_img_tag` filter-hook.
 * 
 * @param string $filtered_image Full img tag with attributes that will replace the source img tag.
 * @param string $context        Additional context, like the current filter name or the function name from where this was called.
 * @param int    $attachment_id  The image attachment ID. May be 0 in case the image is not an attachment.
 *
 * @return string
 */
function wp_kama_content_img_tag_filter( $filtered_image, $context, $attachment_id ){

	// filter...
	return $filtered_image;
}
$filtered_image(строка)
Full img tag with attributes that will replace the source img tag.
$context(строка)
Additional context, like the current filter name or the function name from where this was called.
$attachment_id(int)
The image attachment ID. May be 0 in case the image is not an attachment.

Список изменений

С версии 6.0.0 Введена.

Где вызывается хук

wp_filter_content_tags()
wp_content_img_tag
wp-includes/media.php 1914
$filtered_image = apply_filters( 'wp_content_img_tag', $filtered_image, $context, $attachment_id );

Где используется хук в WordPress

Использование не найдено.