How to remove comment form from WordPress theme

One of the questions that I see a lot from those new to WordPress is how to remove the comment form from a WordPress theme. Mostly because WordPress was originally developed as a blogging platform, most (if not all) WordPress themes include the comment form on both Page and Post templates. However, if you’re using WordPress as a CMS for your website, you most like don’t want to include the comment form on your Pages. Here’s how to remove the form from your Page template.

Warning: You will need to have access to the code (Appearance Editor) to make this modification. If you don’t have access to the code, or aren’t comfortable mucking around in it, stop now and contact your favorite WordPress developer (like me!).

Step One – Backup!

First things first – before you make any changes to your site, always make a full backup. Now, because you will be editing the theme files, you need to be sure that you are backing up the files for your WordPress website, and not just the database. BackupBuddy is a great plugin for this.

Step Two – Finding the right file(s)

Go to Appearance > Editor. The file that is opened by default is your CSS file. You’re not going to be making any changes to this file right now. Look at the template file list on the right side for page.php.

Click on the blue link that above it that says Page Template to open the page.php template in the editor screen.

(If you want to turn off comments on blog posts, you’ll need to open single.php)

Step Three – Finding the code…

If you’re not used to looking at HTML or PHP code, there’s going to be a whole bunch of stuff that looks like gibberish in this template. Don’t worry – you don’t really need to understand it all. You’re looking for some code that looks like this –

[html]< ?php comments_template(); ?>[/html]

The easiest way to find it will probably be to use your browser’s find function (usually CTRL + F).

Once you find that, look around at the lines of code before it (and maybe after) for other things related to the comments. For instance, my theme uses this code to call the comments template on Posts:

[html]
< ?php comments_popup_link(‘No Comments’, ‘1 Comment’, ‘% Comments’); ?> // This shows how many comments there are on this Post/Page

Categories < ?php the_category(‘, ‘) ?>
Tags: < ?php the_tags(‘ ‘, ‘, ‘, ‘ ‘); ?>

You can follow any follow up comments to this entry through the < ?php comments_rss_link(‘RSS 2.0′); ?> feed.

 

< ?php comments_template(); ?> // This actually calls the comment form template.
[/html]

Both the comments count line and the comments_template line of code should be removed to completely remove all traces of the comments from your template.

When you’re done, click the blue Update File button at the bottom of the page.

Step Four – Check Your Work

Now it’s time to go back to the Page or Post in question on your site, and see if you’ve done it correctly. Reload the page (usually F5 in your browser) and the comment form should be gone.

 

If you need help making this change to your WordPress theme, contact beyond the office today. We offer WordPress modification and customization services, and always make a backup of our clients’ site before we start working on them, so you can be sure that your site will be the way you want it.

Terri Orlowski

My friends call me *The WordPress Whisperer* but really, I'm just a girl who likes to play with code and turn it into fabulous websites and stuff.

Latest posts by Terri Orlowski (see all)

Comments

Leave a Reply

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

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>