How To Hide Comments in WordPress Page

How To Hide Comments in WordPress Page

In this article, we’ll see solution for How To Hide Comments in WordPress Page.

WordPress, with its robust features and flexible architecture, allows website owners to customize their pages to suit their unique needs.

While comments provide valuable engagement and interaction, there may be instances where you prefer to hide comments on specific pages to streamline the user experience.

We will explore how to hide comments in WordPress pages effortlessly, empowering you to curate a seamless and distraction-free environment for your readers.

Comments are as much a part of a blog as the article itself. Your comment section engages readers and allows them to interact with other people who have similar interests.

Clients can make inquiries, make talk, and even make jokes or offer pictures relying upon how amazing the remark framework is.

You’ll even discover a few frameworks that give social sharing apparatuses or incorporated networks so you can achieve more guests.

Everything relies upon what sort of interface you’d like and which of the best WordPress remark frameworks you choose.

The Comments on specific posts and pages can help you engage the visitors more time on your website. It also allows your visitors to interact with other people who have the same interest.

The Comments sections can have more information than the actual article. People use the comment feature to solve temporary issues; it also helps you share details and ideas.

People can even use this feature for fun making things; they share jokes and funny images in the comment. But it depends on the comment system’s capability; we need a powerful comment system to share media files in the comment section.

Why Hide Comments in WordPress Pages?

While comments can be a valuable aspect of community engagement, there are situations where it might be beneficial to disable them on specific pages:

  1. Static Pages: WordPress pages like “About Us,” “Contact,” or “Terms and Conditions” typically contain static content where comments may not be necessary. Hiding comments on such pages keeps the focus on the primary content and avoids distractions.
  2. Landing Pages: Landing pages often serve specific purposes like lead generation, event registrations, or product promotions. In these cases, eliminating comments allows visitors to focus solely on the intended call-to-action, improving conversion rates.
  3. Portfolio or Showcase Pages: If you’re using WordPress to showcase your portfolio or a gallery of your work, hiding comments prevents them from overshadowing or cluttering the visual appeal of your creations.

Methods to Hide Comments in WordPress Pages:

Here are different way to hide comments in WordPress pages:

1). Using Quick Edit On Post:

Go to WordPress pages – Click “Quick edit”, you will see the option to give tick mark for comments, you can avoid that tick mark.

yourdomainname.com /wp-admin/edit.php?post_type=page

Then

Click quick edit of each page.


2). Using Page.php

The simplest way is to find out the following line in theme/page.php and delete or comment it.

<?php comments_template( '', true ); ?>

3). Using Functions.php

Add this code to your function.php file

// Disable support for comments and trackbacks in post types
 function df_disable_comments_post_types_support() {
$post_types = get_post_types();
foreach ($post_types as $post_type) {
    if (post_type_supports($post_type, 'comments')) {
        remove_post_type_support($post_type, 'comments');
        remove_post_type_support($post_type, 'trackbacks');
    }
}
}

 add_action('admin_init', 'df_disable_comments_post_types_support');

  // Close comments on the front-end
 function df_disable_comments_status() {
return false;
}

add_filter('comments_open', 'df_disable_comments_status', 20, 2);
add_filter('pings_open', 'df_disable_comments_status', 20, 2);

// Hide existing comments
function df_disable_comments_hide_existing_comments($comments) {
$comments = array();
return $comments;
}

 add_filter('comments_array', 'df_disable_comments_hide_existing_comments', 10, 2);

 // Remove comments page in menu
 function df_disable_comments_admin_menu() {
remove_menu_page('edit-comments.php');
}

   add_action('admin_menu', 'df_disable_comments_admin_menu');

 // Redirect any user trying to access comments page
  function df_disable_comments_admin_menu_redirect() {
 global $pagenow;
if ($pagenow === 'edit-comments.php') {
    wp_redirect(admin_url());
    exit;
}
 }

  add_action('admin_init', 'df_disable_comments_admin_menu_redirect');

  // Remove comments metabox from dashboard
   function df_disable_comments_dashboard() {
remove_meta_box('dashboard_recent_comments', 'dashboard', 'normal');
}

  add_action('admin_init', 'df_disable_comments_dashboard');

  // Remove comments links from admin bar
 function df_disable_comments_admin_bar() {
if (is_admin_bar_showing()) {
    remove_action('admin_bar_menu', 'wp_admin_bar_comments_menu', 60);
}
 }

 add_action('init', 'df_disable_comments_admin_bar');


4) Using Plugin

You can also hide comments in wordpress permanently using https://wordpress.org/plugins/disable-comments-rb/ plugin

WordPress empowers website owners to tailor their content and provide an optimal user experience.

By hiding comments on specific pages, you can streamline your content, reduce distractions, and create a seamless environment for your readers.

So, take charge of your WordPress pages, curate focused content, and leave a lasting impression on your audience by effortlessly hiding comments where they are not needed.

I hope this article helps to hide comments in WordPress.

Write a Reply or Comment

Your email address will not be published. Required fields are marked *