expiration_of_transient_<transient>

Filters the expiration for a transient before its value is set.

Description

apply_filters( 'expiration_of_transient_<transient>', (int) $expiration, (mixed) $value, (string) $transient ); 

The dynamic portion(s) of the hook name refer to the transient name.

Parameters (3)

0. $expiration (int)
Time until expiration in seconds. Use 0 for no expiration.
1. $value (mixed)
New value of transient.
2. $transient (string)
Transient name.

Usage

To run the hook, copy the example below.
  1. $expiration = apply_filters( 'expiration_of_transient_{$transient}', $expiration, $value, $transient ); 
  2.  
  3. if ( !empty( $expiration ) ) { 
  4.  
  5. // everything has led up to this point... 
  6.  
  7.  
The following example is for adding a hook callback.
  1. // define the expiration_of_transient_<transient> callback 
  2. function filter_expiration_of_transient_transient( $expiration, $value, $transient ) { 
  3. // make filter magic happen here... 
  4. return $expiration
  5. }; 
  6.  
  7. // add the filter 
  8. add_filter( "expiration_of_transient_{$transient}", 'filter_expiration_of_transient_transient', 10, 3 ); 
To remove a hook callback, use the example below.
  1. // remove the filter 
  2. remove_filter( "expiration_of_transient_{$transient}", 'filter_expiration_of_transient_transient', 10, 3 ); 

Defined (1)

The filter is defined in the following location(s).

/wp-includes/option.php  
  1. $expiration = apply_filters( "expiration_of_transient_{$transient}", $expiration, $value, $transient );