[wp-hackers] WP Plugin Option API

Mark Jaquith mark.wordpress at txfx.net
Wed Mar 30 07:55:45 GMT 2005

I've been thinking about plugin options and how the move seems to be 
towards giving each plugin its own options page.  There seems to be two 
problems with that: clutter, and work.

It takes effort to design a plugin settings page, and it makes plugins 
quite a bit bigger with all that form stuff and options processing 
code.  Plus, the Options submenu on most installs is quickly filling up.

Some plugins deserve their own options page, because of the sheer number 
of options, and the complexity with which they need to be presented.  
But many plugins only have a handful of simple options to be set, so 
giving them their own options page seems wasteful.  What I would really 
love is a simple WP Plugin Options API.  How it would work would be that 
WordPress would provide a "Plugin Options" page with options grouped by 
plugin, in their own fieldset or "wrap" div.  Adding options from within 
the plugin should be as easy as setting the option_name, option_type, 
option_group, etc. in some sort of add_plugin_option(); function.  The 
Plugin Options page could take all that plugin data, present it in a 
nice format, and handle all the saving/processing stuff.  I think this 
would seriously lower the barrier for plugin devs who want to add 
options that can be changed from within WordPress, but aren't too keen 
on designing their own options page, as they could essentially add that 
capability with one function call.  It would make plugins smaller, 
easier to code, and easier for users to control.  While it wouldn't be 
ideal for every plugin, I think the vast majority of plugins could 
benefit from it.

I've been toying with the idea of creating this API as a plugin, but it 
would make life so much easier if something like this were in the core.

More information about the wp-hackers mailing list