Have add_option() for options whose non-existence has been cached clear that cached non-existence before adding the option. Nice catch by Westi. fixes #3692

git-svn-id: https://develop.svn.wordpress.org/trunk@4820 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Mark Jaquith 2007-01-27 23:06:46 +00:00
parent bae1d18310
commit 2fd34af717
1 changed files with 6 additions and 3 deletions

View File

@ -301,9 +301,12 @@ function update_option($option_name, $newvalue) {
function add_option($name, $value = '', $description = '', $autoload = 'yes') {
global $wpdb;
// Make sure the option doesn't already exist
if ( false !== get_option($name) )
return;
// Make sure the option doesn't already exist we can check the cache before we ask for a db query
if ( true === wp_cache_get($name, 'notoptions') )
wp_cache_delete($name, 'notoptions');
else
if ( false !== get_option($name) )
return;
$value = maybe_serialize($value);