$serialized_value = maybe_serialize( $value );
+ do_action( 'update_option', $option, $old_value, $value );
$result = $wpdb->update( $wpdb->options, array( 'option_value' => $serialized_value ), array( 'option_name' => $option ) );
if ( ! $result )
return false;
wp_cache_set( 'notoptions', $notoptions, 'options' );
}
- do_action( 'update_option', $option, $old_value, $value );
if ( ! defined( 'WP_INSTALLING' ) ) {
$alloptions = wp_load_alloptions();
if ( isset( $alloptions[$option] ) ) {
return $pre;
// prevent non-existent options from triggering multiple queries
- $notoptions = wp_cache_get( 'notoptions', 'site-options' );
+ $notoptions_key = "{$wpdb->siteid}:notoptions";
+ $notoptions = wp_cache_get( $notoptions_key, 'site-options' );
if ( isset( $notoptions[$option] ) )
return apply_filters( 'default_site_option_' . $option, $default );
wp_cache_set( $cache_key, $value, 'site-options' );
} else {
$notoptions[$option] = true;
- wp_cache_set( 'notoptions', $notoptions, 'site-options' );
+ wp_cache_set( $notoptions_key, $notoptions, 'site-options' );
$value = apply_filters( 'default_site_option_' . $option, $default );
}
}
wp_protect_special_option( $option );
$value = apply_filters( 'pre_add_site_option_' . $option, $value );
+ $notoptions_key = "{$wpdb->siteid}:notoptions";
if ( !is_multisite() ) {
$result = add_option( $option, $value );
$cache_key = "{$wpdb->siteid}:$option";
// Make sure the option doesn't already exist. We can check the 'notoptions' cache before we ask for a db query
- $notoptions = wp_cache_get( 'notoptions', 'site-options' );
+ $notoptions = wp_cache_get( $notoptions_key, 'site-options' );
if ( ! is_array( $notoptions ) || ! isset( $notoptions[$option] ) )
if ( false !== get_site_option( $option ) )
return false;
wp_cache_set( $cache_key, $value, 'site-options' );
// This option exists now
- $notoptions = wp_cache_get( 'notoptions', 'site-options' ); // yes, again... we need it to be fresh
+ $notoptions = wp_cache_get( $notoptions_key, 'site-options' ); // yes, again... we need it to be fresh
if ( is_array( $notoptions ) && isset( $notoptions[$option] ) ) {
unset( $notoptions[$option] );
- wp_cache_set( 'notoptions', $notoptions, 'site-options' );
+ wp_cache_set( $notoptions_key, $notoptions, 'site-options' );
}
}
if ( false === $old_value )
return add_site_option( $option, $value );
- $notoptions = wp_cache_get( 'notoptions', 'site-options' );
+ $notoptions_key = "{$wpdb->siteid}:notoptions";
+ $notoptions = wp_cache_get( $notoptions_key, 'site-options' );
if ( is_array( $notoptions ) && isset( $notoptions[$option] ) ) {
unset( $notoptions[$option] );
- wp_cache_set( 'notoptions', $notoptions, 'site-options' );
+ wp_cache_set( $notoptions_key, $notoptions, 'site-options' );
}
if ( !is_multisite() ) {