wp_img_tag_add_srcset_and_sizes_attr хук-фильтр . WP 5.5.0
Filters whether to add the srcset and sizes HTML attributes to the img tag. Default true.
Returning anything else than true will not add the attributes.
Использование
add_filter( 'wp_img_tag_add_srcset_and_sizes_attr', 'filter_function_name_7239', 10, 4 ); function filter_function_name_7239( $value, $image, $context, $attachment_id ){ // filter... return $value; }
- $value(true/false)
- The filtered value.
По умолчанию: true - $image(строка)
- The HTML img tag where the attribute should be added.
- $context(строка)
- Additional context about how the function was called or where the img tag is.
- $attachment_id(число)
- The image attachment ID.
Список изменений
С версии 5.5.0 | Введена. |
Где вызывается хук
wp_img_tag_add_srcset_and_sizes_attr
wp-includes/media.php 1929
$add = apply_filters( 'wp_img_tag_add_srcset_and_sizes_attr', true, $image, $context, $attachment_id );