Special Offer: Buy All 48 Premium WordPress Themes for Just $74.99. Learn more

WordPress Remove Comments from Posts

remove comments form single post

Sometime, you may want to remove the comments sections from posts. Here are instructions how it can be done:

1. Install and Activate the WP Editor plugin: https://wordpress.org/plugins/wp-editor/

It is a very useful plugin which allows you to edit files inside all of the theme folders:

WP Editor Plugin

2. Second step is to remove ‘Comments’ link from the Posts listings

comments link posts list

Navigate to Admin Panel -> Left Menu -> Appearance -> Theme Editor -> then open content.php

Replace the following code:

<span class=”comments-icon”>
<?php comments_popup_link(__( ‘No Comments’, ’tishonator’ ), __( ‘1 Comment’, ’tishonator’ ), __( ‘% Comments’, ’tishonator’ ), ”, __( ‘Comments are closed.’, ’tishonator’ )); ?>
</span><!– .comments-icon –>

With:

<?php /*
<span class=”comments-icon”>
<?php comments_popup_link(__( ‘No Comments’, ’tishonator’ ), __( ‘1 Comment’, ’tishonator’ ), __( ‘% Comments’, ’tishonator’ ), ”, __( ‘Comments are closed.’, ’tishonator’ )); ?>
</span><!– .comments-icon –>
*/ ?>

We simply wrap the code with <?php /* … */ ?>. In this way, you can easily rollback the above change in case you decide to display comments again later.

3. Then we can remove the comments form from Single post pages (screeenshot above):

Navigate to Admin Panel -> Left Menu -> Appearance -> Theme Editor -> then open single.php

Replace the following code:

// if comments are open or there’s at least one comment, load up the comment template.
if ( comments_open() || get_comments_number() ) {
comments_template();
}

with:

/*
// if comments are open or there’s at least one comment, load up the comment template.
if ( comments_open() || get_comments_number() ) {
comments_template();
}
*/

Then save changes and that’s all: No more comments displayed in your website 🙂

About the Author

Tihomir Ivanov is a WordPress web developer, founder of tishonator.com, a fan of Linux and Open Source, a gym enthusiast, a vegan, a fan of minimalism, good movies and books :)

Leave a Reply