How to remove the WordPress comments box from pages

How do I remove the WordPress comments box from pages?We enjoy teaching WordPress and are happy to answer your WordPress questions.

We recently received this from a client, “My friend is muddling through setting up a wp site and is asking how to take the ‘leave a reply box’ off the site??”

What she is asking is how to remove the comment/discussion box.

I’m not sure if she wants to remove 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 can 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

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.

bulk-edit

OR …

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

By default WordPress allows users to comment on pages as well as posts. In this tutorial we'll walk you through several ways to remove the comment box. Find more WordPress tips at learnwp.staging.wpengine.comBegin 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 labeled “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.

screen-options-discussion

discussion-settingsNow, 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.

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.

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' );
}

More tips in our WordPress for Beginners series

We hope that you’ve found these WordPress for Beginners tips helpful.

This post is part of our WordPress Beginners series. If this post was helpful you may be interested in reviewing our WordPress Launchlist.

If you want to learn more about WordPress, attend one of our WordPress Intensive Workshops in Toronto.

How to turn off comments for pages & posts, for just pages and how to modify your WordPress theme to permanently remove comments.
How to turn off comments for pages & posts, for just pages and how to modify your WordPress theme to permanently remove comments.

17 thoughts on “How to remove the WordPress comments box from pages


  1. Thank you for the information regarding removal of “leave a reply” on the twenty twelve WP theme. I followed your instructions to the page.PHP file and deleted the line. It worked fine. Also thanks for the info on Child Themes. That’s a little over my head at the moment, but I can see it has great value when playing around with these free
    themes.

    Barry


  2. Was looking for exactly this. had done this in the past but somehow, was unable to figure it out this time around, your post was a great help, thanks!

    Cheers!
    Rajiv


  3. This tutorial is showing exactly what I did using the quick edit option. A simple fix however its always great to have a source such as this one to keep things moving along.


  4. Comment this line in Comment.php file
    // if ( !current_user_can( ‘edit_comment’, $comment->comment_ID ) )
    // comment_footer_die( __(‘You are not allowed to delete comments on this post.’) );


  5. Thank you so much. I use twenty sixteen theme and have been looking for sometime to turn comments on for pages. I was half right but didn’t tick allow comments at bottom! Thank you i had just about given up.


  6. Wow, thank you!
    I don´t usually find themes where the comments are so difficult to turn off in static pages. I am using Novelite for a client and was going crazy trying to disallow them in static pages but there was no easy way.
    I´ve followed your instructions and it works!!
    Thanks, it was most helpful.
    Esther


    1. Glad that this solved it for you Esther. Thanks for taking the time to comment and let us know that it helped you.

Leave a Reply

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