WordPress.org

Make WordPress Core

Ticket #3692: 2268-fixup.diff

File 2268-fixup.diff, 698 bytes (added by westi, 14 years ago)

Fixup add_option to clear the notoption cache

  • wp-includes/functions.php

     
    301301function add_option($name, $value = '', $description = '', $autoload = 'yes') {
    302302        global $wpdb;
    303303
    304         // Make sure the option doesn't already exist
    305         if ( false !== get_option($name) )
    306                 return;
     304        // Make sure the option doesn't already exist we can check the cache before we ask for a db query
     305        if ( true === wp_cache_get($name, 'notoptions') )
     306                wp_cache_delete($name, 'notoptions');
     307        else
     308                if ( false !== get_option($name) )
     309                        return;
    307310
    308311        $value = maybe_serialize($value);
    309312