X

How to Remove Comments from WordPress Admin Bar

Snippets by IsItWP

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).

Comments   Leave a Reply

  1. Well explained! thanks for sharing

  2. 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’ );

    1. yep, this did the job for me

  3. Not working for me either…

    Avada Child Theme, functions.php

  4. Birdbrain Solutions January 15, 2020 at 3:54 am

    Doesn’t work with 5.3.2

    1. We are able to see it working with WordPress 5.3.2. You may want to check for any theme or plugin conflicts.

Add a Comment

We're glad you have chosen to leave a comment. Please keep in mind that all comments are moderated according to our privacy policy, and all links are nofollow. Do NOT use keywords in the name field. Let's have a personal and meaningful conversation.

WordPress Launch Checklist

The Ultimate WordPress Launch Checklist

We've compiled all the essential checklist items for your next WordPress website launch into one handy ebook.
Yes, Send Me the Free eBook!