[wp-hackers] WP option set bug (or at least discrepancy)
wordpress at tekartist.org
Fri Apr 4 14:30:43 GMT 2008
Stephane Daury - http://tekartist.org/
On Apr 03, 2008, at 12:40, Jacob Santos wrote:
> You should use add_option, while you are installing, unless of
> course the
> option is dynamic. When you are updating, you should use
> In order to figure out whether or not you should update, you should
> get_option to retrieve the option and test whether it is false, then
> either install or upgrade, if needed.
> Proper plugin development techniques should be expressed on the
> codex to
> prevent errors on the part of the developers (not all of whom are
> idiots, I do really stupid crap too, don't get me started, I have a
> list I just shake my head at).
> Back on topic, there has been a patch made to "correct" this issue,
> however it seems partially human error and developers to blame. I
> developers were spoiled off of add_posts() and update_posts(), not all
> code works that way, nor should all code work that way.
> Also on topic, this is the exact reason why you don't put
> that belongs inline in a developer manual setting. When you make a
> inline, you see the documentation there and can update it. Knowing
> it is on the codex is or even if it is on the codex is tedious.
> I will suggest just creating a patch which adds phpdoc to that
> function in
> the source and just give examples of usage on the codex page.
>> Hey all,
>> There's a nasty discrepancy between the core codebase and the codex
>> regards to the update_option() function.
>> In the above docs, the advertised params are :
>> - $name
>> - $value
>> - $description
>> - $autoload
>> But in the code (wp-includes/functions.php), the specs actually are
>> update_option($option_name, $newvalue)
>> The main issue with this is that (as far as I know), everybody uses
>> update_option over add_option, since the docs (and code) states:
>> "This function can be called even if the option does not exist, the
>> function will create the option. ".
>> It's an immediate issue for me that gonna be a big drag, because I
>> need to check if the option exists, then use add or update, since I
>> need to set the autoload flag.
>> Not the end of the world, but I thought I'd mention it before editing
>> the codex page.
>> Is there something I'm missing?!?
>> Stephane Daury - http://tekartist.org/
>> wp-hackers mailing list
>> wp-hackers at lists.automattic.com
> Jacob Santos
> http://www.santosj.name - Personal Blog
> http://funcdoc.wordpress.com - WordPress Function Documentation Blog
> wp-hackers mailing list
> wp-hackers at lists.automattic.com
More information about the wp-hackers