Definition:
function get_transient( $transient ) {}
Get the value of a transient.
If the transient does not exist or does not have a value, then the return value will be false.
Parameters
- string $transient: Transient name. Expected to not be SQL-escaped
Return values
returns:Value of transient
Defined filters
- pre_transient_$transient
apply_filters( 'pre_transient_' . $transient, false ) - transient_$transient
apply_filters( 'transient_' . $transient, $value )
Source code
function get_transient( $transient ) {
global $_wp_using_ext_object_cache;
$pre = apply_filters( 'pre_transient_' . $transient, false );
if ( false !== $pre )
return $pre;
if ( $_wp_using_ext_object_cache ) {
$value = wp_cache_get( $transient, 'transient' );
} else {
$transient_option = '_transient_' . $transient;
if ( ! defined( 'WP_INSTALLING' ) ) {
// If option is not in alloptions, it is not autoloaded and thus has a timeout
$alloptions = wp_load_alloptions();
if ( !isset( $alloptions[$transient_option] ) ) {
$transient_timeout = '_transient_timeout_' . $transient;
if ( get_option( $transient_timeout ) < time() ) {
delete_option( $transient_option );
delete_option( $transient_timeout );
return false;
}
}
}
$value = get_option( $transient_option );
}
return apply_filters( 'transient_' . $transient, $value );
}
1867

February 12, 2011 


No comments yet... Be the first to leave a reply!