Removing Comments from Pages WordPress

Comments are an essential part of any blog. Comments on pages, however, are not necessary and often times intrusive to the overall design. It may seem at first that their is no easy way to turn off comments on pages. That may be the case, but before you turn to a plugin to solve this problem, let’s dig into the code instead.

To navigate to your WordPress website’s code, make sure that you are an admin and hover over “Appearance” in the side menu. From the drop down list, choose “Editor.” Inside this editor lives the core files of your website. Look through the list on the left hand side of the screen and find the link titled “page.php” and click on it.

Inside this file is the PHP which acts dynamically to fill each page of your website with the relevant content. The overall makeup of this page is very simple and straight forward. Their is a header, a loop (content call), sidebar call, comment call and finally footer call. We want to locate the comment call and eliminate it.

Removing Comments in WordPress

Scroll down through the code and find the piece of code that looks like this <?php comments_template(); ?> and cut it to your clipboard. Hit the big blue “Update File” button at the bottom of the page. Now go back to your pages and see if the comments are still showing through. If there are any errors as you navigate through the site, go back to where you copied out the code and paste it back in and save. This should fix back the error.

If your comments are gone, however, then congratulations!

BONUS: Don’t throw away that handy little piece of PHP code: <?php comments_template(); ?>

It can be used anywhere inside of your other PHP files to add a comments area. Try a comments field in your index.php or footer.php file. These may not be that attractive of options either, but it can be fun to experiment.

Have you had success adding or removing comments on your site? Tell us about it in the comments!

Jophiel Silvestrone

Written by: Jophiel Silvestrone

Jophiel Silvestrone has written 163 posts in the Tech Blog.

Jophiel grew up on a ranch in Paradise Valley, Montana near Chico Hot Springs. Working on the ranch instilled work ethic and self motivation. Filled with this drive, Jophiel started mowing the local school's yards twice a month throughout the summers, at the age of 12. He moved to Billings in 2004, where he has been deeply involved in the local business community ever since. A serial entrepreneur, Jophiel has ran multiple businesses in our local community. He now runs a web development company SkyPoint Studios. One of his favorite jobs though, is fathering his 11-year old son Jaoquin. "JJ" also loves technology.

0 replies

Leave a Reply

Want to join the discussion?
Feel free to contribute!

Leave a Reply

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

This site uses Akismet to reduce spam. Learn how your comment data is processed.