Add $expiration as a parameter to the pre_set_transient_{$transient} filter.

Props mgibbs189
Fixes #30576

Built from https://develop.svn.wordpress.org/trunk@31414


git-svn-id: http://core.svn.wordpress.org/trunk@31395 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
John Blackbourn 2015-02-11 17:12:26 +00:00
parent cd4fc46cf2
commit 4d12ccadd8
2 changed files with 7 additions and 5 deletions

View File

@ -628,18 +628,20 @@ function get_transient( $transient ) {
*/ */
function set_transient( $transient, $value, $expiration = 0 ) { function set_transient( $transient, $value, $expiration = 0 ) {
$expiration = (int) $expiration;
/** /**
* Filter a specific transient before its value is set. * Filter a specific transient before its value is set.
* *
* The dynamic portion of the hook name, `$transient`, refers to the transient name. * The dynamic portion of the hook name, `$transient`, refers to the transient name.
* *
* @since 3.0.0 * @since 3.0.0
* @since 4.2.0 Added `$expiration` parameter.
* *
* @param mixed $value New value of transient. * @param mixed $value New value of transient.
* @param int $expiration Time until expiration in seconds.
*/ */
$value = apply_filters( 'pre_set_transient_' . $transient, $value ); $value = apply_filters( 'pre_set_transient_' . $transient, $value, $expiration );
$expiration = (int) $expiration;
if ( wp_using_ext_object_cache() ) { if ( wp_using_ext_object_cache() ) {
$result = wp_cache_set( $transient, $value, 'transient', $expiration ); $result = wp_cache_set( $transient, $value, 'transient', $expiration );

View File

@ -4,7 +4,7 @@
* *
* @global string $wp_version * @global string $wp_version
*/ */
$wp_version = '4.2-alpha-31413'; $wp_version = '4.2-alpha-31414';
/** /**
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema. * Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.