pre_option_{$option}

FILTER wp-includes\option.php (ligne 132) github
Filters the value of an existing option before it is retrieved. The dynamic portion of the hook name, `$option`, refers to the option name. Returning a value other than false from the filter will short-circuit retrieval and return that value instead.

Paramètres

Entrée :
false, $option, $default_value
Sortie :
@param mixed  $pre_option    The value to return instead of the option value. This differs from
@param string $option        Option name.
@param mixed  $default_value The fallback value to return if the option does not exist.

Utilisation

// Modifier la valeur avec le filtre 'pre_option_{$option}'
add_filter('pre_option_{$option}', 'ma_fonction_filtre', 10, 1);

function ma_fonction_filtre(false) {
    // Modifier la valeur
    return false;
}

Actualités

Chargement des actualités...