From 0f36a1e33b6e0856234394b125bf48bac52bba9b Mon Sep 17 00:00:00 2001 From: Jon Cave Date: Wed, 19 Oct 2011 21:06:50 +0000 Subject: [PATCH] Don't cache default value in get_site_option() for non-existent options. Fixes #18955. git-svn-id: https://develop.svn.wordpress.org/trunk@19012 602fd350-edb4-49c9-b593-d223f7449a82 --- wp-includes/functions.php | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/wp-includes/functions.php b/wp-includes/functions.php index 32c0cbb8b0..cf9c11ed91 100644 --- a/wp-includes/functions.php +++ b/wp-includes/functions.php @@ -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 ) ); // 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; - else + $value = maybe_unserialize( $value ); + wp_cache_set( $cache_key, $value, 'site-options' ); + } else { $value = $default; - - $value = maybe_unserialize( $value ); - - wp_cache_set( $cache_key, $value, 'site-options' ); + } } }