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
This commit is contained in:
John Blackbourn 2015-02-11 17:11:18 +00:00
parent 4f8c251c45
commit b384c8cf25
1 changed files with 6 additions and 4 deletions

View File

@ -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 );