cover

Managing WordPress Admin Menus

We frequently find ourselves doing freelance work for people that know very little about WordPress. This lack of know-how often found in clients can lead to disastrous consequences, throwing hours of hard work out of the window. Ask any freelancer with some experience and he will tell will that, at least once, a client clicked that little button that was not supposed to be clicked and everything in the project just broke down.

That being said, it’s important for us to guarantee that the client has no access to crucial parts of the admin interface to prevent this kind of disastrous events.

Plugins: the drawbacks

WordPress powers a large proportion of the internet for many years now. That made possible for it to grow an awesome community of developers that tried – and continue to do so – to solve a variety of use cases of the platform. For any feature you may need for your website, chances are that there’s a plugin that do exactly that.

While that is awesome for freelancers that can just install this plugins and save an enormous amount of  development time, it also generates a bloated mess in the admin menu.

Bloated Menus as a result of having many plugins installed.

Bloated Menus as a result of having many plugins installed.

That’s exactly where the danger lies: a bunch of menu items that the final user did not need to see are now exposed.

Hiding the menu items manually

To avoid this kind of problems we need to hide menu items that are not suitable to anyone else. WordPress, as expected, offers a programmatically way of doing that.

To remove a menu item them we can just use the function remove_menu_page. Just pass the slug of the menu as a parameter and voilà. For the default menu items, as a exemple, you need to do this:

remove_menu_page('edit.php');                // Posts
remove_menu_page('upload.php');              // Media
remove_menu_page('link-manager.php');        // Links
remove_menu_page('edit-comments.php');       // Comments
remove_menu_page('edit.php?post_type=page'); // Pages
remove_menu_page('plugins.php');             // Plugins
remove_menu_page('themes.php');              // Appearance
remove_menu_page('users.php');               // Users
remove_menu_page('tools.php');               // Tools
remove_menu_page('options-general.php');     // Settings

A better way: WP Admin Menu Manager

The manual way may work well for smaller projects and fewer pages, it gets complicated to do with a large number of installed plugins. It also gets hard to remove different menus for different user or roles as the code starts to get messy and with lots of if statements.

In this cases is much better to have a UI that allows you to hide, rename and reorder the menu items as you wish. It would also be nice to have the possibility of assign different menus for different user or user roles.

We had this issue more than once with freelance projects here at 732 and we soon realized that a tool capable of doing this things was a true necessity.

After some months of development then we came up with WordPress Admin Menu Manager.

With WP Admin Menu Manager you can do all that, using a very simple and intuitive UI.

You can get more information about WP Admin Menu Manager visiting the plugin’s website. Fell free to share you opinions and doubts in the comments section!

Subscribe to Blog via Email

Enter your email address to subscribe to this blog and receive notifications of new posts by email.

0 replies

Leave a Reply

Want to join the discussion?
Feel free to contribute!

Leave a Reply