wppaste
WordPress

apply_filters( 'pre_wp_get_loading_optimization_attributes', array|false $loading_attrs, string $tag_name, array $attr, string $context )

Since
6.4.0
Filters whether to short-circuit loading optimization attributes.

Description

Returning an array from the filter will effectively short-circuit the loading of optimization attributes, returning that value instead.

Compatibility

WordPress
since 6.4.0
  • 6.7.7
  • 6.8.8
  • 6.9.7
  • 7.0.4
  • 7.1.0

Present in every tracked release (6.7.7 to 7.1.0).

Parameters

$loading_attrsarray|false
False by default, or array of loading optimization attributes to short-circuit.
$tag_namestring
The tag name.
$attrarray
Array of the attributes for the tag.
$contextstring
Context for the element for which the loading optimization attribute is requested.

Where this hook fires · 1

  • wp-includes/media.php:6166wp_get_loading_optimization_attributes()

Source code

	 *	 * @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.	 */	$loading_attrs = apply_filters( 'pre_wp_get_loading_optimization_attributes', false, $tag_name, $attr, $context ); 	if ( is_array( $loading_attrs ) ) {		return $loading_attrs;	} 	$loading_attrs = array();

Changelog

Introduced in 6.4.0. Unchanged from 6.7.7 through 7.1.0.

  1. 6.7.7
  2. 6.8.8
  3. 6.9.7
  4. 7.0.4
  5. 7.1.0

Signature, return type and hooks compared across 5 parsed releases.

About this page

Parsed data
Generated from the wordpress-develop 7.1.0 tag, and regenerated for each WordPress release so it tracks the code rather than a snapshot of it.
Corrections
Something wrong on this page? Report it and it gets fixed in the next regeneration.