Filter hook 'wp_img_tag_add_loading_attr'

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

Description

Filters the `loading` attribute value to add to an image. Default `lazy`. Returning `false` or an empty string will not add the attribute. Returning `true` will add the default value.

Occurrences

Filename Line Number
wp-includes/media.php 2057
wp-includes/deprecated.php 4799

Parameters

Type Name Description
string|bool $value The `loading` attribute value. Returning a falsey value will result in the attribute being omitted for the image.
string $image The HTML `img` tag to be filtered.
string $context Additional context about how the function was called or where the img tag is.

PHP Doc

/**
		 * Filters the `loading` attribute value to add to an image. Default `lazy`.
		 *
		 * Returning `false` or an empty string will not add the attribute.
		 * Returning `true` will add the default value.
		 *
		 * @since 5.5.0
		 *
		 * @param string|bool $value   The `loading` attribute value. Returning a falsey value will result in
		 *                             the attribute being omitted for the image.
		 * @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.
		 */