Rename internal variable in set_transient()
.
The previous name was inadvertently changing the dynamic part of `set_transient_{transient}` action and the transient name passed to the action since [35082]. Props GregLone. Fixes #34470. git-svn-id: https://develop.svn.wordpress.org/trunk@35431 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
parent
198ad14ffd
commit
78a2cf3db6
@ -712,30 +712,30 @@ function set_transient( $transient, $value, $expiration = 0 ) {
|
||||
$result = wp_cache_set( $transient, $value, 'transient', $expiration );
|
||||
} else {
|
||||
$transient_timeout = '_transient_timeout_' . $transient;
|
||||
$transient = '_transient_' . $transient;
|
||||
if ( false === get_option( $transient ) ) {
|
||||
$transient_option = '_transient_' . $transient;
|
||||
if ( false === get_option( $transient_option ) ) {
|
||||
$autoload = 'yes';
|
||||
if ( $expiration ) {
|
||||
$autoload = 'no';
|
||||
add_option( $transient_timeout, time() + $expiration, '', 'no' );
|
||||
}
|
||||
$result = add_option( $transient, $value, '', $autoload );
|
||||
$result = add_option( $transient_option, $value, '', $autoload );
|
||||
} else {
|
||||
// If expiration is requested, but the transient has no timeout option,
|
||||
// delete, then re-create transient rather than update.
|
||||
$update = true;
|
||||
if ( $expiration ) {
|
||||
if ( false === get_option( $transient_timeout ) ) {
|
||||
delete_option( $transient );
|
||||
delete_option( $transient_option );
|
||||
add_option( $transient_timeout, time() + $expiration, '', 'no' );
|
||||
$result = add_option( $transient, $value, '', 'no' );
|
||||
$result = add_option( $transient_option, $value, '', 'no' );
|
||||
$update = false;
|
||||
} else {
|
||||
update_option( $transient_timeout, time() + $expiration );
|
||||
}
|
||||
}
|
||||
if ( $update ) {
|
||||
$result = update_option( $transient, $value );
|
||||
$result = update_option( $transient_option, $value );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user