This post was sparked by a recent Tweet by John Blackbourn (warning, contains some strong language).
TL;DR – John installed 45 custom block plugins and 21 of them added a top level admin menu item.
This is a personal gripe of ours at WP Editorial. Why do plugin developers all think their plugin belongs in the WordPress admin menu?
This is in no way limited to block plugins Let’s take WP Mail SMTP for example (don’t even get us started about the non-default styles here…). There’s absolutely no reason why this couldn’t be a sub menu of the default WordPress settings. Afterall, once you’ve set it up, it’s very unlikely that you will revisit it any time soon. If anyone from the WP Mail SMTP or WPForms would like to tell us the rationale behind this then we’re all ears. Even the Gutenberg feature plugin is an offender here.
This is most terrible when building sites for clients. Clients don’t understand what WP Mail SMTP is and for the best part they don’t care. Sure, we as developers can lock this down (and you should) but why have it there in the first place?
Not all developers are bad at this though. We’d like to give a special shout out to:
Just to name a few – all of these put their settings in the default WordPress settings menu. Let us know some of the other ‘good guys (and gals!)’ in the comments.
How do go about changing this?
Honestly, this probably belongs in the WordPress standards, as well as part of the plugin review process. Better guidance should lead to better results.
Short-term solutions
Until developers stop doing this, we’re going to need solutions to stop this. There’s two easy solutions here:
- Admin Menu Editor – this plugin offers an easy to use visual way to edit the menu.
- Using code
The code method is surprisingly simple, although the plugin method can be more eloquent if you want to turn things on and off quickly.
Warning: before doing any code changes you should make a backup. This code could either go in a feature plugin or in your theme (or child theme) functions.php file.
add_action('admin_menu', 'your_prefix_remove_menu_items');
function your_prefix_remove_menu_items() {
remove_menu_page( 'edit.php' ); // posts
remove_menu_page( 'edit-comments.php' ); // comments
}
As you can see, this simple function just accepts the URL of the menu item and removes them. Neat huh?
We’d love to know your thoughts
We would love to know your thoughts on this in the comments. Especially suggestions on how to best tackle this issue. Let us know down below!