set_transient

FILTER wp-includes\option.php (ligne 1433) github
Filters the value of an existing transient before it is retrieved. The dynamic portion of the hook name, `$transient`, refers to the transient name. Returning a value other than false from the filter will short-circuit retrieval and return that value instead.
traduction française
Filtre la valeur d'un transitoire existant avant qu'il ne soit récupéré. La partie dynamique du nom du crochet, `$transient`, fait référence au nom du transitoire. Renvoyer une valeur autre que false à partir du filtre court-circuitera la récupération et renverra cette valeur à la place.

Paramètres

Entrée :
$transient, $value, $expiration = 0
Sortie :
@param mixed  $pre_transient The default value to return if the transient does not exist.
@param string $transient     Transient name.
@param mixed  $value     Value of transient.
@param string $transient Transient name.
@param string $transient  Transient name. Expected to not be SQL-escaped.
@param mixed  $value      Transient value. Must be serializable if non-scalar.
@param int    $expiration Optional. Time until expiration in seconds. Default 0 (no expiration).
@return bool True if the value was set, false otherwise.

Utilisation

Filtrer un transient avant sauvegarde

Filtre avant sauvegarde.

database
add_filter('pre_set_transient_custom', 'validate_transient');
function validate_transient($value) {
    return $value;
}

Actualités

Chargement des actualités...