How to remove the WordPress comments box from pages

We appreciate educating WordPress and are glad to answer to your WordPress remarks and questions.

We as of late gotten this from a customer, “My companion is wading through setting up a wp site and is requesting that how take the ‘leave an answer box’ off the site??”

What she is asking is the means by which to expel the remark/exchange box.

I don’t know whether she needs to expel it site-wide from pages and posts or just from her static pages.

In this post we’ll cover all the steps you need to take to turn off WordPress comments:

  1. How to turn off comments on pages & posts
  2. How to turn off comments for just pages
  3. How to modify your page template to permanently remove comments
  4. How to add a function to your theme that will remove comments from pages

If you want to skip these steps and go with the easiest solution you can use a free disable comments plugin.


Solution #1:
How to turn off comments sitewide (pages & posts)

Go to Settings » Discussion » untick “Allow people to post comments on new articles

This solution applies to new posts/pages that you will publish from now on. If you have already published posts/pages you’ll need to do the following BULK EDIT to disallow comments from posts and pages that have already been published.

Bulk Edit

  1. Go to All Pages » at top next to title tick the box to select all pages
  2. Click “Edit” under bulk actions
  3. Click “apply”
  4. Choose “do not allow” next to comments
  5. Click “update”

Now repeat the bulk edit for all Posts.

OR …

Solution #2:

How to turn off WordPress comments for pages only (leave on for blog posts)

Begin with a bulk edit as explained above to turn off comments for all pages that have been published to date. If you only have a couple of pages you can click Quick Edit and turn off comments in quick edit view.

Make Discussion Options visible

You may also find it very helpful to make discussion options visible on pages, this will allow you to turn off comments on the individual page before you publish it. If you don’t see the section labelled “Discussion” below the visual editor (where you type your page content), then you need to click on the ‘Screen Options’ button located in the upper right-hand corner of the page you are on.

Here’s how to display Discussion options on a page:

  1. In the top right-hand corner of your WordPress admin panel (just below the dark grey toolbar and the Howdy, message) there is a tab called Screen Options. Click to open the screen options tab.
  2. Tick the box for Discussion
  3. Click the Screen Options tab again to close it.
discussion-settings

Now, scroll down the page to Discussion settings and untick the boxes for “Allow comments” and “Allow trackbacks and pingbacks on this page”. The problem with this solution is that you will need to remember to turn off comments on all new pages you publish.

Solution #3:

How to remove Comments from a WordPress Page Template

The best solution is to remove one line of code from the page template that calls the comments. Always create a Child Theme before you edit theme files.

If you are using the Twenty Ten theme you would open the loop-page.php file. Locate (2nd last line) and remove the line

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

If you are using the Twenty Twelve theme you would open the page.php file and find the same line of code.

Solution #4:

How to remove WordPress Comments through the functions file

Note: If there are already comments on pages — do one of the methods above to remove all past existing comments before using this method.

Open your child theme functions.php file and add this code to remove comment support for pages.

//remove comments from pages
add_action('init', 'remove_comment_support', 100);

function remove_comment_support() {
remove_post_type_support( 'page', 'comments' );
}

Leave a Reply

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