Switch language

wpseek.com
A WordPress-centric search engine for devs and theme authors




set_transient [ WordPress Function ]

set_transient ( $transient, $value, $expiration = 0 )
Parameters:
  • (string) $transient Transient name. Expected to not be SQL-escaped.
  • (mixed) $value Transient value. Expected to not be SQL-escaped.
  • (int) $expiration Time until expiration in seconds, default 0
Uses:
Returns:
  • (bool) False if value was not set and true if value was set.
Defined at:



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 ) {
    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_timeouttime() + $expiration'''no' );
            }
            
$result add_option$transient$value''$autoload );
        } else {
            if ( 
$expiration )
                
update_option$transient_timeouttime() + $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ý

Dahasý ...

0 User Note(s)

Henüz yok. Ýlk sen ol!

Yeni Ekle ...



HTML5 Powered with CSS3 / Styling, Performance & Integration, and Semantics