[wp-hackers] Need help with: coding new Plugin options

Ozh ozh at planetozh.com
Wed Nov 5 12:26:23 GMT 2008


More or less as Viper, but I also have a comment regarding your first
function: making get_option then an update_option on each plugin start
is a waste. Read options, sure, but why rewrite them? That's an extra
useless query.

On Wed, Nov 5, 2008 at 12:03 PM, Viper007Bond <viper at viper007bond.com> wrote:
> I don't have the time at the moment to read your code, but have you taken a
> look at http://codex.wordpress.org/Creating_Options_Pages ?
>
> On Wed, Nov 5, 2008 at 1:58 AM, Daiv Mowbray <daiv at daivmowbray.com> wrote:
>> function setDefaultAdminOptions() {
>>                $defaultAdminOptions = array("load_moo" => "true",
>>                                "css_load" => "true");
>>
>>                $defaultOptions = get_option($this->AdminOptionsName);
>>                if (!empty($defaultOptions)) {
>>                        foreach ($defaultOptions as $key => $option) {
>>                                $defaultAdminOptions[$key] = $option;
>>                        }
>>                }
>>                update_option($this->AdminOptionsName,
>> $defaultAdminOptions);
>>                return $defaultAdminOptions;
>>
>>        }

-- 
http://planetOzh.com ~ Blog and WordPress Stuff
http://FrenchFragFactory.net ~ Daily Quake News


More information about the wp-hackers mailing list