Transients, add filters for `$expiration`:
* `'expiration_pre_set_site_transient_' . $transient` * `'expiration_pre_set_transient_' . $transient` Props chriscct7, wpsmith, nacin. Fixes #21330. Built from https://develop.svn.wordpress.org/trunk@34865 git-svn-id: http://core.svn.wordpress.org/trunk@34830 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
53060a8987
commit
1dcc6e1b51
|
@ -695,6 +695,19 @@ function set_transient( $transient, $value, $expiration = 0 ) {
|
|||
*/
|
||||
$value = apply_filters( 'pre_set_transient_' . $transient, $value, $expiration, $transient );
|
||||
|
||||
/**
|
||||
* Filter the expiration for a transient before its value is set.
|
||||
*
|
||||
* The dynamic portion of the hook name, `$transient`, refers to the transient name.
|
||||
*
|
||||
* @since 4.4.0
|
||||
*
|
||||
* @param mixed $value New value of transient.
|
||||
* @param int $expiration Time until expiration in seconds.
|
||||
* @param string $transient Transient name.
|
||||
*/
|
||||
$expiration = apply_filters( 'expiration_pre_set_transient_' . $transient, $expiration, $value, $transient );
|
||||
|
||||
if ( wp_using_ext_object_cache() ) {
|
||||
$result = wp_cache_set( $transient, $value, 'transient', $expiration );
|
||||
} else {
|
||||
|
@ -1589,6 +1602,19 @@ function set_site_transient( $transient, $value, $expiration = 0 ) {
|
|||
|
||||
$expiration = (int) $expiration;
|
||||
|
||||
/**
|
||||
* Filter the expiration for a transient before its value is set.
|
||||
*
|
||||
* The dynamic portion of the hook name, `$transient`, refers to the transient name.
|
||||
*
|
||||
* @since 4.4.0
|
||||
*
|
||||
* @param mixed $value New value of transient.
|
||||
* @param int $expiration Time until expiration in seconds.
|
||||
* @param string $transient Transient name.
|
||||
*/
|
||||
$expiration = apply_filters( 'expiration_pre_set_site_transient_' . $transient, $expiration, $value, $transient );
|
||||
|
||||
if ( wp_using_ext_object_cache() ) {
|
||||
$result = wp_cache_set( $transient, $value, 'site-transient', $expiration );
|
||||
} else {
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
*
|
||||
* @global string $wp_version
|
||||
*/
|
||||
$wp_version = '4.4-alpha-34864';
|
||||
$wp_version = '4.4-alpha-34865';
|
||||
|
||||
/**
|
||||
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.
|
||||
|
|
Loading…
Reference in New Issue