pre_wp_get_loading_optimization_attributes
Filters whether to short-circuit loading optimization attributes.
Returning an array from the filter will effectively short-circuit the loading of optimization attributes, returning that value instead.
Usage
add_filter( 'pre_wp_get_loading_optimization_attributes', 'wp_kama_pre_wp_get_loading_optimization_attributes_filter', 10, 4 ); /** * Function for `pre_wp_get_loading_optimization_attributes` filter-hook. * * @param array|false $loading_attrs False by default, or array of loading optimization attributes to short-circuit. * @param string $tag_name The tag name. * @param array $attr Array of the attributes for the tag. * @param string $context Context for the element for which the loading optimization attribute is requested. * * @return array|false */ function wp_kama_pre_wp_get_loading_optimization_attributes_filter( $loading_attrs, $tag_name, $attr, $context ){ // filter... return $loading_attrs; }
- $loading_attrs(array|false)
- False by default, or array of loading optimization attributes to short-circuit.
- $tag_name(string)
- The tag name.
- $attr(array)
- Array of the attributes for the tag.
- $context(string)
- Context for the element for which the loading optimization attribute is requested.
Changelog
Since 6.4.0 | Introduced. |
Where the hook is called
pre_wp_get_loading_optimization_attributes
wp-includes/media.php 5742
$loading_attrs = apply_filters( 'pre_wp_get_loading_optimization_attributes', false, $tag_name, $attr, $context );