pre_transient_(transient) filter-hookWP 2.8.0

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.

Usage

add_filter( 'pre_transient_(transient)', 'wp_kama_pre_transient_filter', 10, 2 );

/**
 * Function for `pre_transient_(transient)` filter-hook.
 * 
 * @param mixed  $pre_transient The default value to return if the transient does not exist. Any value other than false will short-circuit the retrieval of the transient, and return that value.
 * @param string $transient     Transient name.
 *
 * @return mixed
 */
function wp_kama_pre_transient_filter( $pre_transient, $transient ){

	// filter...
	return $pre_transient;
}
$pre_transient(mixed)
The default value to return if the transient does not exist. Any value other than false will short-circuit the retrieval of the transient, and return that value.
$transient(string)
Transient name.

Changelog

Since 2.8.0 Introduced.
Since 4.4.0 The $transient parameter was added

Where the hook is called

get_transient()
pre_transient_(transient)
wp-includes/option.php 1213
$pre = apply_filters( "pre_transient_{$transient}", false, $transient );

Where the hook is used in WordPress

Usage not found.