contacts

Get All 146 Premium WordPress Themes for Just $59.99
One-Time Payment: Unlimited Use Across Unlimited Domains, Plus Free Lifetime Updates! Learn more

WordPress Remove Comments from Posts

WordPress Remove Comments from Posts

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

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

comments link posts list

Navigate to Admin Panel -> Left Menu -> Appearance -> 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 -> 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 🙂