wp_get_loading_optimization_attributes
Filter HookDescription
Filters the loading optimization attributes.Hook Information
File Location |
wp-includes/media.php
View on GitHub
|
Hook Type | Filter |
Line Number | 6182 |
Hook Parameters
Type | Name | Description |
---|---|---|
array
|
$loading_attrs
|
The loading optimization attributes. |
string
|
$tag_name
|
The tag name. |
array
|
$attr
|
Array of the attributes for the tag. |
string
|
$context
|
Context for the element for which the loading optimization attribute is requested. |
Usage Examples
Basic Usage
<?php
// Hook into wp_get_loading_optimization_attributes
add_filter('wp_get_loading_optimization_attributes', 'my_custom_filter', 10, 4);
function my_custom_filter($loading_attrs, $tag_name, $attr, $context) {
// Your custom filtering logic here
return $loading_attrs;
}
Source Code Context
wp-includes/media.php:6182
- How this hook is used in WordPress core
<?php
6177 * @param array $loading_attrs The loading optimization attributes.
6178 * @param string $tag_name The tag name.
6179 * @param array $attr Array of the attributes for the tag.
6180 * @param string $context Context for the element for which the loading optimization attribute is requested.
6181 */
6182 return apply_filters( 'wp_get_loading_optimization_attributes', $loading_attrs, $tag_name, $attr, $context );
6183 }
6184
6185 /**
6186 * Gets the threshold for how many of the first content media elements to not lazy-load.
6187 *
PHP Documentation
<?php
/**
* Filters the loading optimization attributes.
*
* @since 6.4.0
*
* @param array $loading_attrs The loading optimization attributes.
* @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.
*/
Quick Info
- Hook Type: Filter
- Parameters: 4
- File: wp-includes/media.php
Related Hooks
Related hooks will be displayed here in future updates.