Don't cache default value in get_site_option() for non-existent options. Fixes #18955.
git-svn-id: http://svn.automattic.com/wordpress/trunk@19012 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
16daac44ec
commit
148a9e8039
|
@ -3798,14 +3798,13 @@ function get_site_option( $option, $default = false, $use_cache = true ) {
|
||||||
$row = $wpdb->get_row( $wpdb->prepare("SELECT meta_value FROM $wpdb->sitemeta WHERE meta_key = %s AND site_id = %d", $option, $wpdb->siteid ) );
|
$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
|
// Has to be get_row instead of get_var because of funkiness with 0, false, null values
|
||||||
if ( is_object( $row ) )
|
if ( is_object( $row ) ) {
|
||||||
$value = $row->meta_value;
|
$value = $row->meta_value;
|
||||||
else
|
|
||||||
$value = $default;
|
|
||||||
|
|
||||||
$value = maybe_unserialize( $value );
|
$value = maybe_unserialize( $value );
|
||||||
|
|
||||||
wp_cache_set( $cache_key, $value, 'site-options' );
|
wp_cache_set( $cache_key, $value, 'site-options' );
|
||||||
|
} else {
|
||||||
|
$value = $default;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue