From b384c8cf259cb0af20a7e281b6cb017ce89e4aa7 Mon Sep 17 00:00:00 2001 From: John Blackbourn Date: Wed, 11 Feb 2015 17:11:18 +0000 Subject: [PATCH] Add `$expiration` as a parameter to the `pre_set_transient_{$transient}` filter. Props mgibbs189 Fixes #30576 git-svn-id: https://develop.svn.wordpress.org/trunk@31414 602fd350-edb4-49c9-b593-d223f7449a82 --- src/wp-includes/option.php | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/wp-includes/option.php b/src/wp-includes/option.php index 9b3e884388..1916b7e1fa 100644 --- a/src/wp-includes/option.php +++ b/src/wp-includes/option.php @@ -628,18 +628,20 @@ function get_transient( $transient ) { */ function set_transient( $transient, $value, $expiration = 0 ) { + $expiration = (int) $expiration; + /** * Filter a specific transient before its value is set. * * The dynamic portion of the hook name, `$transient`, refers to the transient name. * * @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 ); - - $expiration = (int) $expiration; + $value = apply_filters( 'pre_set_transient_' . $transient, $value, $expiration ); if ( wp_using_ext_object_cache() ) { $result = wp_cache_set( $transient, $value, 'transient', $expiration );