wp_img_tag_add_decoding_attr хук-фильтрWP 6.1.0

Filters the decoding attribute value to add to an image. Default async.

Returning a falsey value will omit the attribute.

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

add_filter( 'wp_img_tag_add_decoding_attr', 'wp_kama_img_tag_add_decoding_attr_filter', 10, 3 );

/**
 * Function for `wp_img_tag_add_decoding_attr` filter-hook.
 * 
 * @param string|false|null $value   The `decoding` attribute value. Returning a falsey value will result in the attribute being omitted for the image. Otherwise, it may be: 'async' (default), 'sync', or 'auto'.
 * @param string            $image   The HTML `img` tag to be filtered.
 * @param string            $context Additional context about how the function was called or where the img tag is.
 *
 * @return string|false|null
 */
function wp_kama_img_tag_add_decoding_attr_filter( $value, $image, $context ){

	// filter...
	return $value;
}
$value(строка|false|null)
The decoding attribute value. Returning a falsey value will result in the attribute being omitted for the image. Otherwise, it may be: 'async' (default), 'sync', or 'auto'.
$image(строка)
The HTML img tag to be filtered.
$context(строка)
Additional context about how the function was called or where the img tag is.

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

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

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

wp_img_tag_add_decoding_attr()
wp_img_tag_add_decoding_attr
wp-includes/media.php 1985
$value = apply_filters( 'wp_img_tag_add_decoding_attr', 'async', $image, $context );

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

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