Posts

Showing posts from February 4, 2014

WordPress admin menu slugs

Dashboardremove_menu_page(‘index.php’);Dashboard        remove_submenu_page( ‘index.php’, ‘index.php’ );Updatesremove_submenu_page( ‘index.php’, ‘update-core.php’ );Postsremove_menu_page(‘edit.php’);Postsremove_submenu_page( ‘edit.php’, ‘edit.php’ );Add Newremove_submenu_page( ‘edit.php’, ‘post-new.php’ );Categoriesremove_submenu_page( ‘edit.php’, ‘edit-tags.php?taxonomy=category’ );Post Tagsremove_submenu_page( ‘edit.php’, ‘edit-tags.php?taxonomy=post_tag’ );Mediaremove_menu_page(‘upload.php’);Libraryremove_submenu_page( ‘upload.php’, ‘upload.php’ );Add Newremove_submenu_page( ‘upload.php’, ‘media-new.php’ );Linksremove_menu_page(‘link-manager.php’);Linksremove_submenu_page( ‘link-manager.php’, ‘link-manager.php’ );Add Newremove_submenu_page( ‘link-manager.php’, ‘link-add.php’ );Link Categories  remove_submenu_page( ‘link-manager.php’, ‘edit-tags.php?taxonomy=link_category’ );Pagesremove_menu_page(‘edit.php?post_type=page’);Pagesremove_submenu_page( ‘edit.php?post_type=page’, ‘edit.p…

Removing menu pages from the WordPress admin

In this tutorial, I’ll cover the remove_menu_page() and remove_submenu_page() functions, which were added in WordPress 3.1.

The first thing you need to decide is where you’re putting the code. I’ll assume you’re either dropping this in your theme’s functions.php file or one of your plugin files.

1. Removing top-level menu pagesUsage remove_menu_page( $menu_slug );Examples <?php function remove_menus(){ remove_menu_page( 'index.php' ); //Dashboard remove_menu_page( 'edit.php' ); //Posts remove_menu_page( 'upload.php' ); //Media remove_menu_page( 'edit.php?post_type=page' ); //Pages remove_menu_page( 'edit-comments.php' ); //Comments remove_menu_page( 'themes.php' ); //Appearance remove_menu_page( 'plugins.php' ); //Plugins remove_menu_page( 'users.php' ); //Users remove_menu_page( 'too…