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.
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
Or just simply uncheck “Allow people to post comments on the article” at Discussion Settings? o_O
I think this is perfect for bloggers who have a lot of haters
@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.
Simple yet many beginners are not aware of it..
Yan
@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
I agree with “fromtheold”, but I would only use it for pages and other things that don’t really require comments
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
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.
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.
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]
@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.
Yes, I totally agree
As a user, being your site, you know better than everyone [usually
] what will it be the final structure.
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’.
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!
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?
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: