Ack!  There has been a sudden surge in plugin releases that make use of the new add_options_page() function.  I think it's great that the community is so interested in extending WordPress this way with such great features.  But there's a problem...  If your plugin's options page only has one item on it (like a single checkbox or a textbox), then you're taking up a relative ton of real estate on the admin console to enable your options.  Take this Amazon ASIN linker plugin for example.  It's a great idea.  But it you install 4 of these options-light plugins, you've got an Options menu that streches all the way across the screen!  It's not a problem with the design of any one plugin, but unless plugin devs start interacting with one another, the issue could escalate.  So what's a plugin developer to do?  Here's an idea... 
SmallOptions is a new plugin that consolidates a bunch of other plugin option pages onto a single "Plugins" option page.  Before you poo-poo this idea, check it out...  It's optional.  That's right.  If you code your plugin appropriately, and it's really easy to do so, you can distribute it with or without SmallOptions.  If you activate your plugin without SmallOptions enabled, it installs its own Options menu just like it did before.  If you activate your plugin with SmallOptions enabled, your options page magically becomes part of the Options | Plugins submenu.  I think that's pretty cool.  This idea was spawned by email from Graeme, who is working on the GeoMap plugin, which should soon (if it doesn't already) integrate into the Geo plugin that I wrote.  GeoMap uses the coordinates that Geo supplies, and so it was a natural fit to combine both interfaces if they're both available.  I've packed the SmallOptions plugin with a sample plugin that shows you how to build your plugin so that they can work together.  The process is pretty simple:

  1. Separate your form and div wrapper from the fields that you're using to obtain options.  Put these in separate functions inside your plugin, and call the function to output the form innards from inside the function that outputs the form wrapper.  (Confused?  The code is more clear.)
  2. When adding your admin menu, check to see if the SmallOptions class exists.  If it does, instead of adding your menu to the admin submenu, sink the small_options_page action hook to your form innards function.
  3. Be sure to handle the storage of your options in the function that produces the form innards.  See the sample plugin for a neat method of doing this.

I'm not suggesting that this is the best method for consolidating options pages.  After all, converting the Amazon plugin I mentioned above would take a bit more work to get going.  (It uses the options.php page to save it's options, which is perfectly valid, but requires that you submit the form to options.php, which SmallOptions won't do.) But something has to happen to keep all of these Options menus from taking over my admin panel!  Even if you don't use SmallOptions (and you shouldn't if your plugin has many options to set or requires a more complicated interface) you should check out the sample plugin in the archive, which provides a simple example of building a plugin with its own options page.


Thanks, i'll check it out and most likely add the small options to my flickr plugin. I was thinking along the same lines when I was making the plugin, the options panels make it so easy to configure a plugin, but you notice the screen space disappearing pretty quickly.

I'm glad you like it. :)

If more people are interested in getting this going, I'm going to host it on (whenever Matt is able to add it) and will entertain any suggestions from people who want to use it.

People also need to start planning on where to put their pages. A lot of the plugins that have put things under "Options" really should be under "Manage" or some other top-level menu. But, I think you brought this up on the hackers list. I just hope people start doing it!

I'm having problems making this work, and I tried to troubleshoot but keep coming up clueless.

When SmallOptions isn't activated, the sample_options_page won't work for me unless I deactivate Spam Karma. The Sample button gets added, but the function that generates the form content doesn't seem to be activating.

When I use sample_options_page with SmallOptions activated, I get a Plugins menu under Options, but it gives this error where it should be showing the options box for the sample:

Warning: call_user_func_array(): First argumented is expected to be a valid callback, '' was given in /path/to/wp-content/plugins/small_options.php on line 77

It does this even if I disable every other plugin I have installed. It seems to me that it again isn't recognizing the function name that generates the content. The rest of the page loads correctly -- only the part where the form would be is coming up wrong, with that error.

I have no clue whether the problem lies on my server somehow or if it's with the code, but I dug around the code and couldn't figure anything out.

I really like the idea though -- I was starting to notice the sudden explosion of menu items myself, and this seems like a good solution to address at least some of it. I hope plugin devs start using it.


David Nagle reports a nasty bug that prevents the sample from working. I found the same problem -- here's the solution:

In small_options.php, we need to change two lines in the function small_options_page. Comment out the line:

$function_name = $function['function'];

then change the line below this from:

$string = call_user_func_array($function_name, $args);


$string = call_user_func_array($function, $args);

and it will work.

Sorry, commenting on this post is disabled.