pre_wp_get_loading_optimization_attributes хук-фильтрWP 6.4.0

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.

Использование

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(массив|false)
False by default, or array of loading optimization attributes to short-circuit.
$tag_name(строка)
The tag name.
$attr(массив)
Array of the attributes for the tag.
$context(строка)
Context for the element for which the loading optimization attribute is requested.

Список изменений

С версии 6.4.0 Введена.

Где вызывается хук

wp_get_loading_optimization_attributes()
pre_wp_get_loading_optimization_attributes
wp-includes/media.php 6166
$loading_attrs = apply_filters( 'pre_wp_get_loading_optimization_attributes', false, $tag_name, $attr, $context );

Где используется хук в WordPress

Использование не найдено.