wp_omit_loading_attr_threshold

FUNCTION wp-includes\media.php (ligne 5983) github
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.

Paramètres

Entrée :
$force = false
Sortie :
@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.
@param array $default_header_enforced_contexts Map of contexts for which elements should be considered
@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.
@param bool $force Optional. If set to true, the filter will be (re-)applied even if it already has been before.
@return int The number of content media elements to not lazy-load.

Utilisation

// Utilisation de la fonction wp_omit_loading_attr_threshold
$result = wp_omit_loading_attr_threshold($force = false);

if ($result) {
    // Votre logique ici
}

Actualités

Chargement des actualités...