set_site_transient

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

Paramètres

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

Utilisation

// Utilisation de la fonction set_site_transient
$result = set_site_transient($transient, $value, $expiration = 0);

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

Actualités

Chargement des actualités...