How to hide Menu Options in the WordPress admin interface

This is surprisingly easy thanks to a function called remove_menu_page();

To remove the Dashboard item for example, you can use the function like this:

// remove Dashboard
remove_menu_page('index.php');

The parameter is the filename of the item you’d like to hide. To find out what that is, simply hover over the menu options in the admin interface and watch URL your browser displays at the bottom. If your browser doesn’t display anything, click on the menu item in question and see that the URL looks like. The parameter you need is anything after wp-admin/

Note that this will only hide the menu item – users can still navigate directly to the page via direct link.

I’ve used this functionality in a plugin called Zen Dash – take a look at the code which is well documented.

For more information check out the WordPress Codex:
http://codex.wordpress.org/Function_Reference/remove_menu_page





Jay is the CEO and founder of WP Hosting, a boutique style managed WordPress hosting and support service. He has been working with Plesk since version 9 and is a qualified Parallels Automation Professional. In his spare time he likes to develop iOS apps and WordPress plugins, or draw on tablet devices. He blogs about his coding journey at http://wpguru.co.uk and http://pinkstone.co.uk.