[wp-hackers] Adding custom taxonomies as submenus to custom admin top-level menu

Mike Schinkel mikeschinkel at newclarity.net
Sat Jul 31 21:35:45 UTC 2010


Daniel:

Is this what you are looking for?

add_action('admin_menu', 'my_admin_menu');
function my_admin_menu() {
	add_menu_page('My Plugin Menu','My Plugin Menu', 'manage_options', 'admin.php?action=my_plugins_action');
	add_submenu_page('admin.php?action=my_plugins_action', 'Pitch Statuses', 'Pitch Statuses', 'manage_options', 'edit-tags.php?taxonomy=pitch_status');
	add_submenu_page('admin.php?action=my_plugins_action', 'User Types', 'User Types', 'manage_options', 'edit-tags.php?taxonomy=user_type');
	add_submenu_page('admin.php?action=my_plugins_action', 'User Roles', 'User Roles', 'manage_options', 'edit-tags.php?taxonomy=user_role');
}

Note, this assumes:

1.) You creates a custom post type for users that mirrors the user (There is currently no way to create a taxonomy for a user),
2.) Your main plugin page is located in the admin at "admin.php?action=my_plugins_action".

-Mike

On Jul 31, 2010, at 5:04 PM, Daniel Bachhuber wrote:

> Hey all,
> I'm creating a plugin that uses three custom taxonomies ('pitch_status', 'user_type', and 'user_role'). The first is tied to posts and the second and third are tied to users. I'd like to use add_submenu_page to add the edit screens for each of these taxonomies to the custom menu for the plugin. Is this possible? I'd prefer not to reinvent the wheel and have to create my own edit views.
> 
> Thanks much,
> 
> Daniel
> 
> --
> Daniel Bachhuber
> www.danielbachhuber.com
> danielbachhuber at gmail.com
> cell: +1 971 998 5407
> aim/skype/twitter: danielbachhuber
> 
> _______________________________________________
> wp-hackers mailing list
> wp-hackers at lists.automattic.com
> http://lists.automattic.com/mailman/listinfo/wp-hackers



More information about the wp-hackers mailing list