Filter hook 'wp_lazy_loading_enabled'

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

View Source

wp_lazy_loading_enabled

Filter Hook
Description
Filters whether to add the `loading` attribute to the specified tag in the specified context.

Hook Information

File Location wp-includes/media.php View on GitHub
Hook Type Filter
Line Number 1847

Hook Parameters

Type Name Description
bool $default Default value.
string $tag_name The tag name.
string $context Additional context, like the current filter name or the function name from where this was called.

Usage Examples

Basic Usage
<?php
// Hook into wp_lazy_loading_enabled
add_filter('wp_lazy_loading_enabled', 'my_custom_filter', 10, 3);

function my_custom_filter($default, $tag_name, $context) {
    // Your custom filtering logic here
    return $default;
}

Source Code Context

wp-includes/media.php:1847 - How this hook is used in WordPress core
<?php
1842  	 * @param bool   $default  Default value.
1843  	 * @param string $tag_name The tag name.
1844  	 * @param string $context  Additional context, like the current filter name
1845  	 *                         or the function name from where this was called.
1846  	 */
1847  	return (bool) apply_filters( 'wp_lazy_loading_enabled', $default, $tag_name, $context );
1848  }
1849  
1850  /**
1851   * Filters specific tags in post content and modifies their markup.
1852   *

PHP Documentation

<?php
/**
	 * Filters whether to add the `loading` attribute to the specified tag in the specified context.
	 *
	 * @since 5.5.0
	 *
	 * @param bool   $default  Default value.
	 * @param string $tag_name The tag name.
	 * @param string $context  Additional context, like the current filter name
	 *                         or the function name from where this was called.
	 */
Quick Info
  • Hook Type: Filter
  • Parameters: 3
  • File: wp-includes/media.php
Related Hooks

Related hooks will be displayed here in future updates.