Do you want to remove comments from your WordPress admin bar? It’s easy with our code snippet. Let’s take a look.
Instructions:
All you have to do is add this code to your theme’s functions.php file or in a site-specific plugin:
function remove_comments(){ global $wp_admin_bar; $wp_admin_bar->remove_menu('comments'); } add_action( 'wp_before_admin_bar_render', 'remove_comments' );
Note: If this is your first time adding code snippets in WordPress, then please refer to our guide on how to properly copy / paste code snippets in WordPress, so you don’t accidentally break your site.
If you liked this code snippet, please consider checking out our other articles on the site like: Best WordPress Page Builders (Compared).
Well explained! thanks for sharing
You need to remove the Admin page itself; the code above will not do it alone in WP 5.4
/**
* Removes Top Level Menu
*/
function prefix_remove_comments_tl() {
remove_menu_page( ‘edit-comments.php’ );
}
add_action( ‘admin_menu’, ‘prefix_remove_comments_tl’ );
yep, this did the job for me
Not working for me either…
Avada Child Theme, functions.php
Doesn’t work with 5.3.2
We are able to see it working with WordPress 5.3.2. You may want to check for any theme or plugin conflicts.