get_site_option [ WordPress Function ]
get_site_option ( $option, $default = false, $use_cache = true )
| Parameters: |
|
| Uses: | |
| See: | |
| Returns: |
|
| Defined at: |
|
Benzer Fonksiyonlar: get_user_option, delete_site_option, get_option, add_site_option, update_site_option
Retrieve site option value based on name of option.
Source
<?php
function get_site_option( $option, $default = false, $use_cache = true ) {
global $wpdb;
// Allow plugins to short-circuit site options.
$pre = apply_filters( 'pre_site_option_' . $option, false );
if ( false !== $pre )
return $pre;
if ( ! is_multisite() ) {
$default = apply_filters( 'default_site_option_' . $option, $default );
$value = get_option($option, $default);
} else {
$cache_key = "{$wpdb->siteid}:$option";
if ( $use_cache )
$value = wp_cache_get($cache_key, 'site-options');
if ( !isset($value) || (false === $value) ) {
$row = $wpdb->get_row( $wpdb->prepare("SELECT meta_value FROM $wpdb->sitemeta WHERE meta_key = %s AND site_id = %d", $option, $wpdb->siteid ) );
// Has to be get_row instead of get_var because of funkiness with 0, false, null values
if ( is_object( $row ) ) {
$value = $row->meta_value;
$value = maybe_unserialize( $value );
wp_cache_set( $cache_key, $value, 'site-options' );
} else {
$value = apply_filters( 'default_site_option_' . $option, $default );
}
}
}
return apply_filters( 'site_option_' . $option, $value );
}
?>
Examples [ wp-snippets.com ]
Google Arama Sonuçlarý
- WPMU Functions/get site option « WordPress Codex
(3:30:36 PM) omry: it appears that get_site_option() returns an incorrect an empty value if called from wpmu_new_blog when user registers a user and a blog at ...
codex.wordpress.org - Function Reference/get site option « WordPress Codex
Description. Retrieve option value based on name of option. In multisite, return network option, blog option otherwise. Usage. <?php get_site_option( $option ...
codex.wordpress.org - #18955 (get_site_option caches default value when option does not ...
If get_site_option is passed any default value on a non-existent site option then a subsequent call to update_site_option will not add the site option. Because the ...
core.trac.wordpress.org - Pay to Blog Plugin. Question about disabling every 3 mo and annual ...
Mar 1, 2011 ... <?php $pay_to_blog_1_cost = get_site_option( "pay_to_blog_1_cost" ); $counter = 0.0; for ( $counter = 0.0; $counter <= 200; $counter += 0.1) ...
premium.wpmudev.org