wp_get_loading_optimization_attributes


wp_get_loading_optimization_attributes ( $tag_name, $attr, $context )

Parameters:
  • (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.
Returns:
  • (array) Loading optimization attributes.
Defined at:

Description

Gets loading optimization attributes.This function returns an array of attributes that should be merged into the given attributes array to optimize loading performance. Potential attributes returned by this function are: - `loading` attribute with a value of "lazy" - `fetchpriority` attribute with a value of "high" - `decoding` attribute with a value of "async" If any of these attributes are already present in the given attributes, they will not be modified. Note that no element should have both `loading="lazy"` and `fetchpriority="high"`, so the function will trigger a warning in case both attributes are present with those values.

Related Functions

wp_img_tag_add_loading_optimization_attrs, get_language_attributes, wp_get_loading_attr_default, wp_get_plugin_action_button, wp_sanitize_script_attributes

Top Google Results

User discussions

wpseek mobile