Make WordPress Core


Ignore:
Timestamp:
11/09/2005 06:15:55 PM (21 years ago)
Author:
ryan
Message:

Options fixes from donncha. fixes #1859

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-includes/functions.php

    r3012 r3023  
    268268
    269269        if ( false === $value ) {
    270                 $value = $wpdb->get_var("SELECT option_value FROM $wpdb->options WHERE option_name = '$setting'");
    271                 wp_cache_add($setting, $value, 'options');
     270                $value = $wpdb->get_row("SELECT option_value FROM $wpdb->options WHERE option_name = '$setting'");
     271                if( is_object( $value ) ) {
     272                        $value = $value->option_value;
     273                        wp_cache_set($setting, $value, 'options');
     274                }
    272275        }
    273276
    … …  
    344347        // If it's not there add it
    345348        if ( !$wpdb->get_var("SELECT option_name FROM $wpdb->options WHERE option_name = '$option_name'") )
    346                 add_option($option_name);
     349                add_option($option_name, $newvalue);
    347350
    348351        wp_cache_set($option_name, $newvalue, 'options');
    … …  
    366369
    367370        // Make sure the option doesn't already exist
    368         if ( false !== get_option($name, 'options') )
     371        if ( false !== get_option($name) )
    369372                return;
    370373
    … …  
    373376                $value = serialize($value);
    374377
    375         wp_cache_add($name, $value, 'options');
     378        wp_cache_set($name, $value, 'options');
    376379
    377380        $name = $wpdb->escape($name);
Note: See TracChangeset for help on using the changeset viewer.