[wp-hackers] Options and caching

Ozh ozh at planetozh.com
Wed Jan 30 10:27:21 GMT 2008


>if (get_option("myoption")=="")
>                update_option("myoption","defaultvalue");
>
>and later...
>
>get_option("myoption");

First thing:
get_option('doesnotexist') returns false, not an empty string.

Then, what about the following:
if (!get_option('myoption')) {
        update_option('myoption', 'default');
        wp_cache_flush();
}


Ozh


More information about the wp-hackers mailing list