Hiding Elements from WordPress Admin Menu

Written by: John | 24th Sep 2014

Do you want to remove certain unwanted elements from the WordPress admin menu, to stop your client from becoming confused or overwhelmed? Here’s how.

WordPress has a neat little function built in to do just that, namely: remove_menu_page().
The great thing about this function is the pages are not removed, just the admin menu link!

For example:

remove_menu_page( 'upload.php');

Would remove the link to the media library, but the page its self would still exist and could be accessed by the admin via: http://your-domain.com/wp-admin/upload.php.

How to use this function?

We need to add this function(s) to a hook and the best place to do this is functions.php. To remove Posts, Tools, Media, comments and a portfolio section (if your theme has one) add this to your functions.php:

//HIDE UNWANTED ITEMS FROM WP ADMIN MENU
function your_admin_clean_up(){
 remove_menu_page( 'edit.php?post_type=portfolio');
 remove_menu_page( 'upload.php'); 
 remove_menu_page( 'edit-comments.php');
 remove_menu_page( 'edit.php'); 
 remove_menu_page( 'tools.php'); 
 }
 add_action('admin_menu', 'your_admin_clean_up');

That’s it! To find out more about the remove_menu_page function look here

Related Posts

Code

Swipe close for mobile menu

Using Vanilla JS (ish) to add swipe features to mobile views.
Code

Full Width YouTube Videos

Make YouTube videos take the full width of an element while retaining the 16:9 ratio.
Code

CSS Transitions

Easy copy and paste transition css, to enable transitions to all properties.
Code

Command Line SSH stuff

Some tips and tricks for using the command line to do useful stuff, mainly just a reference for myself.
Code

Handy, dandy WordPress excerpt length function

If you have been using WordPress on multiple projects you must have come up against needing to pull a custom excerpt size? Now there are many ways to do this, eg, you could use this to pull say 80 characters…