[wp-hackers] Need help with: coding new Plugin options
wordpress at dd32.id.au
Thu Nov 6 22:45:33 GMT 2008
On Fri, 07 Nov 2008 07:54:20 +1100, Ozh <ozh at planetozh.com> wrote:
> On Thu, Nov 6, 2008 at 9:49 PM, Daiv Mowbray <daiv at daivmowbray.com>
>> Ozh, the functions which you refer are from the plugin builder:
>> It reads to see if the options are there, if not they write the default
>> the ops table.
>> If you know another way to check for options ... all ears.
> A lot of plugins do this on every instantiation:
> 1) read options from DB
> 2) do various checks, including default values
> 3) write options in DB
> The write part is totally unneeded and is just a query waste, since
> after step 2 everything is ok. Just to steps 1 and 2, and write to the
> DB only when options are updated through the admin form.
Just a note.. update_option() doesnt do a query unless the value has
changed from what its got in its cache:
More information about the wp-hackers