How to Hide Comments from the Top Bar in WordPress

Managing the WordPress admin dashboard efficiently is crucial for maintaining a streamlined workflow. If your website does not rely on comment functionality or if you simply want to declutter the top bar (also known as the admin toolbar), hiding the Comments section is a useful tweak. WordPress displays a notification bubble in the top bar whenever new comments are awaiting moderation, which may not be necessary for every user.

In this guide, we will explore different methods to hide the Comments section from the top bar in WordPress, including built-in settings, custom code, and plugins.

Why Hide Comments from the Top Bar?

There are several reasons why website owners and administrators may want to remove the Comments icon from the WordPress admin bar:

  • Minimal Distraction: If you do not manage comments, removing the notification helps keep the admin panel cleaner.
  • Security Purposes: Multi-user websites may want to hide certain admin options from specific roles.
  • Performance Considerations: Reducing unnecessary notifications can improve admin efficiency.

Method 1: Hiding Comments Using a Plugin

The easiest way to disable the comment icon from the top bar is by using a plugin. This is especially useful for users unfamiliar with code modifications.

  1. Log in to your WordPress dashboard.
  2. Go to Plugins > Add New.
  3. Search for a plugin like Disable Comments or Adminimize.
  4. Install and activate the plugin.
  5. Follow the plugin settings to disable comments site-wide or from the admin bar only.

Many plugins provide an option to disable comments globally, which may also help declutter other areas of your WordPress dashboard.

Method 2: Removing Comments with Custom Code

If you prefer a lightweight method without additional plugins, you can remove the Comments menu item using custom code. This method is suitable for those comfortable editing WordPress theme files.

Step 1: Access the Theme’s functions.php File

You can add custom code to your theme’s functions.php file or a site-specific plugin. Follow these steps:

  1. Navigate to Appearance > Theme File Editor in your WordPress dashboard.
  2. Locate and open the functions.php file of your active theme.

Step 2: Insert the Code

Add the following snippet to the end of your functions.php file:

add_action('admin_bar_menu', function($wp_admin_bar) {
    $wp_admin_bar->remove_node('comments');
}, 999);

This function removes the Comments entry from the top bar, effectively decluttering the admin toolbar.

Step 3: Save and Test

After adding the code, click the Update File button and refresh your dashboard to check if the comments icon has been removed.

Method 3: Restricting Access with User Role Management

For multi-user websites, you may want to hide comments only for specific user roles. This ensures that administrators retain access while others do not.

To achieve this, modify the above code snippet to apply only to specific user roles:

add_action('admin_bar_menu', function($wp_admin_bar) {
    if (!current_user_can('manage_options')) {
        $wp_admin_bar->remove_node('comments');
    }
}, 999);

This code hides the Comments item for all users except administrators. It is useful for sites managed by multiple authors or contributors.

Final Thoughts

Hiding comments from the WordPress top bar is a simple yet effective modification that enhances admin usability. Whether you choose a plugin for simplicity or a code-based approach for performance, implementing this change keeps your dashboard clean and distraction-free.

If you frequently manage multiple WordPress sites, consider using a plugin that provides global administrative controls. For developers, adding a few code snippets to the theme functions ensures minimal dependency on third-party plugins.

By applying the right approach, you can customize WordPress to better suit your administrative needs.