Switch language

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




add_site_option [ WordPress Function ]

add_site_option ( $option, $value )
Parameters:
  • (string) $option Name of option to add. Expected to not be SQL-escaped.
  • (mixed) $value Optional. Option value, can be anything. Expected to not be SQL-escaped.
Uses:
See:
Returns:
  • (bool) False if option was not added and true if option was added.
Defined at:



Add a new site option.

Existing options will not be updated. Note that prior to 3.3 this wasn't the case.

Source


<?php
function add_site_option$option$value ) {
    global 
$wpdb;

    
$value apply_filters'pre_add_site_option_' $option$value );

    if ( !
is_multisite() ) {
        
$result add_option$option$value );
    } else {
        
$cache_key "{$wpdb->siteid}:$option";

        if ( 
false !== get_site_option$option ) )
            return 
false;

        
$value sanitize_option$option$value );
        
wp_cache_set$cache_key$value'site-options' );

        
$_value $value;
        
$value maybe_serialize$value );
        
$result $wpdb->insert$wpdb->sitemeta, array('site_id' => $wpdb->siteid'meta_key' => $option'meta_value' => $value ) );
        
$value $_value;
    }

    if ( 
$result ) {
        
do_action"add_site_option_{$option}"$option$value );
        
do_action"add_site_option"$option$value );
        return 
true;
    }
    return 
false;
}
?>

Examples [ wp-snippets.com ]

Google Arama Sonuçlarý

Dahasý ...

Kullanýcý Tartýþmalarý [ wordpress.org ]

- Bulunamadý -

Yeni bir konu yaz ...

0 User Note(s)

Henüz yok. Ýlk sen ol!

Yeni Ekle ...



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