How to: Get rid of the comment section on your WordPress blog

Altought it can be weird in some points because comments are an important part of a blog, I have read many user asking how they can get rid of the “comments” section on their WordPress theme. That’s very easy to do. Just read on.

Removing the comments section on a blog can sound weird at first, but sometimes you just want to spread some news without getting any feedback.
In case you don't want any post to be commented, just edit your single.php file from your theme.

Find the following line:

<?php comments_template(); ?>

and delete it. THat's simple at that!

31 Responses

Oct 23 2008 11:32

Or just simply uncheck “Allow people to post comments on the article” at Discussion Settings? o_O

Oct 23 2008 13:22

I think this is perfect for bloggers who have a lot of haters :)

Oct 23 2008 14:43

@Marko: You’re right! But this recipe may be usefull for exemple, to someone who design a CMS theme where there’s no comments section.

Oct 23 2008 16:53

Simple yet many beginners are not aware of it..

Yan

Oct 23 2008 21:13

@Marko if you disable the comments you are still stuck with “no comments allowed on this post” but if you remove the comments section as described here you are left with nothing which makes it cleaner

Oct 23 2008 21:48

I agree with “fromtheold”, but I would only use it for pages and other things that don’t really require comments :)

Oct 24 2008 22:56

i absolutly afree with “fromtheold” that´s why i´m commenting out the comments … <!– –> … i like it more “none-destructive” and most sites aren´t too big since gradient-times 2.0 :D

Nov 02 2008 15:05

Though this will remove the comments section but what about the comments count…any widgets related to comments. People should be careful with removing that too also along with this code.

Dec 07 2008 13:57

There is another way (follow the link on my name). We wanted comments on the ‘blog’ section, but not anywhere else. So I added a bit of php around the comments code; from memory, it’s along the lines of:

if ( in_category (‘3′) ) { comments_template(); }

where ‘3′ is the category that I want to allow comments in. If not in that category, you don’t get the form, no message about comments being closed, etc.

Dec 28 2008 22:16

Why delete the line and not comment it? :)

Commenting it may allow other users enable the comments later :) [if we talk about a theme designer]

Dec 28 2008 23:47

@Plurkr: I’m pretty sure that any theme designer will comment the line instead of deleting it ;) But as an user, you can delete it on your theme if you’re sure that you don’t need comments.

Dec 29 2008 09:34

Yes, I totally agree :)

As a user, being your site, you know better than everyone [usually :D ] what will it be the final structure.

Jun 11 2009 16:32

Found this post when I was looking for a way to disable further comments. I wanted to leave previous comments but disallow all future comments. I could get a WP plugin to do this or change the comment setting for each individual post. Turning off comments in the admin panel helps, but it only affects comments on future posts.

If anyone is interested, I addressed my particular need by logging into my MySQL server and updating the comment_status column in the wp_posts table and set the value to “closed”. I wrote something like this SQL query:

UPDATE wp_posts SET comment_status = ‘closed’;

However, in hindsight I should have done something like this:

UPDATE wp_posts SET comment_status = ‘closed’ WHERE comment_status = ‘open’;

Minor difference but it would have allowed me to see if anything was set to something other than the default of ‘open’.

Oct 18 2009 02:31

I was having a hard time disabling the comments from Disqus on my pages. This took care of it without leaving that nasty “Comments are disabled for this post” line at the end.

Thanks!

Dec 07 2009 23:53

I’m trying to remove the comment section from only (1) one of my pages, but am unable to without removing them from all of them. Any suggestions?

@GaryTaylor – Can your code be reversed to allow this?

Mar 09 2010 11:19

Thank you this helped so much, our website working on rehoming abused and unwanted animals, when we refuse to give the wrong people animals they can leave hateful comments on the website. So this helps alot. thank you again :)

Trackbacks:

Leave a Comment

* Name, Email, Comment are Required