[wp-hackers] 2.next - plugin options

Owen Winkler ringmaster at midnightcircus.com
Wed Mar 8 14:24:00 GMT 2006

Mark Jaquith wrote:
> On Mar 8, 2006, at 1:17 AM, Kaf Oseo wrote:
>> There's a discussion on the forums right now about how best to
>> handle the increasing use of option pages by plugins, which is
>> beginning to crowd the sub menus for some:
>> http://wordpress.org/support/topic/63824
> I think that the Plugins submenu should be restricted to things having 
> to do with plugin management... like editing, activating, downloading, 
> upgrading etc.

I agree with this, but I also know that there are some plugins that have 
a single setting (an update URL, an image URL, a snippet of text, etc.) 
that makes having a whole submenu page somewhat overkill.

I've taken to doing really crazy things to get around this, like adding 
an extra link to the plugins page under the "Deactivate" link that says 
"Configure".  When you click this link, the plugin displays a 
configuration form.  (My plugins use Ajax to display the form in-place, 
but it will fallback to using a regular panel like I describe below.)

It might be beneficial to include a hook in the Action column on the 
Plugin activation page that allows plugin authors to easily add a link 
to a configuration page.  If added in this way, the link could point to 
any admin panel.  Using this method it would also be possible to create 
temporary panels under the Plugins menu that only exist when accessed 
via that link.  Doing this is trivial:

add_filter('plugin_action', 'plugin_action_link');  // new hook
add_action('admin_menu', 'plugin_admin_menu');
function plugin_action_link($actions) {
	return $actions . '<a href="plugins.php?page='
		. plugin_basename(__FILE__)
		. '">' . __('Configure') . '</a>';
function plugin_admin_menu() {
	// A new add_plugin_options_page() function could
	// fill the role of this if() statement:
	if($_GET['page'] == plugin_basename(__FILE__)) {
			'Configure Plugin',
			'Plugin Config',
function plugin_config_panel() {
	// display this plugin's config panel

As a result, plugins with simple configurations could all display them 
directly on the plugins page without needlessly cluttering any submenus. 
  Plugins with existing configuration panels can also link to them 
directly from the Plugins list page, also eliminating the issue of 
having to hunt for an obscure or poorly located plugin options page.

Identical functionality to the described hook already exists in Matt 
Read's Installer.


More information about the wp-hackers mailing list