set_transient [ WordPress Function ]
set_transient ( $transient, $value, $expiration = 0 )
| Parameters: |
|
| Uses: | |
| Returns: |
|
| Defined at: |
|
Benzer Fonksiyonlar: get_transient, set_site_transient, delete_transient, get_site_transient, delete_site_transient
Set/update the value of a transient.
You do not need to serialize values. If the value needs to be serialized, then it will be serialized before it is set.
Source
<?php
function set_transient( $transient, $value, $expiration = 0 ) {
global $_wp_using_ext_object_cache;
$value = apply_filters( 'pre_set_transient_' . $transient, $value );
if ( $_wp_using_ext_object_cache ) {
$result = wp_cache_set( $transient, $value, 'transient', $expiration );
} else {
$transient_timeout = '_transient_timeout_' . $transient;
$transient = '_transient_' . $transient;
if ( false === get_option( $transient ) ) {
$autoload = 'yes';
if ( $expiration ) {
$autoload = 'no';
add_option( $transient_timeout, time() + $expiration, '', 'no' );
}
$result = add_option( $transient, $value, '', $autoload );
} else {
if ( $expiration )
update_option( $transient_timeout, time() + $expiration );
$result = update_option( $transient, $value );
}
}
if ( $result ) {
do_action( 'set_transient_' . $transient );
do_action( 'setted_transient', $transient );
}
return $result;
}
?>
Examples [ wp-snippets.com ]
Google Arama Sonuçlarý
- Function Reference/set transient « WordPress Codex
Description. Set/update the value of a transient. You do not need to serialize values. If the value needs to be serialized, then it will be serialized before it is set.
codex.wordpress.org - Transients API « WordPress Codex
Saving Transients. To save a transient you use set_transient() : ... $transient the unique slug used while saving the transient with set_transient(). In our case we ...
codex.wordpress.org - WordPress › Support » Data set via set_transient() doesn't persist ...
I'm not sure if I'm completely missing the scope of set_transient() and set_site_transient() , but neither appear to persist the data I'm trying to cache beyond the ...
wordpress.org - set_transient
Mar 29, 2012 ... Exceptions and errors happen, there is nothing you can do about it if your building sites. Since they are going to happen let's make sure that we ...
wpthemetutorial.com
Kullanýcý Tartýþmalarý [ wordpress.org ]
- ironprogrammer on "Data set via set_transient() doesn't persist beyond scope of function call"
- ironprogrammer on "Data set via set_transient() doesn't persist beyond scope of function call"
- whooami on "undefined function set_transient"
- whooami on "undefined function set_transient"
- edbarton on "undefined function set_transient"
- edbarton on "undefined function set_transient"