• Skip to primary navigation
  • Skip to main content
  • Skip to primary sidebar

WP SITES

2785

Original Genesis & WooCommerce Tutorials & 6000+ Guaranteed Code

Snippets

  • Try Premium
  • Log in

Remove Comments From Specific Posts and Different Categories

Need to remove comments and the comment form on your posts? In this tutorial, i’ll show you how to:

  • disable comments on specific posts
  • remove comments from all posts in a category
  • remove comments from all posts in multiple categories.
  • remove comments from all but one category.
  • remove comments entirely from different themes.

Disable Comments on Specific Posts

If you need to disable comments on specific posts, you can easily disable them on each post manually.

discussion settings

You can also add the i.d’s for each post to an array in a custom function.

Simply replace the numbers in the array with the posts i.d’s you want to remove your comments from and separate them with a comma.

Remove Comments From All Posts In One Category

Remove Comments From All Posts In Multiple Categories

In this case replace the numbers in the array with the i.d’s for each category you want to exclude comments on.

Remove Comments From All But One Category

Replace the category i.d with the i.d for the category you want to allow comments on. This code will disable comments on all posts in all but one category.

Remove Comments Completely From Your Site

If you don’t want any comments on your site ever, you can remove this line of code from your single.php file.

<?php comments_template(); ?>

Remove Comments From Genesis Theme

This code will remove all comments from your entire site.

Plugins for Removing Comments

Not a coder? Lucky for you i’ve searched the WordPress plugin repo and found a plugin which enables you to easily remove comments from your blog posts.

Disable Comments enables you to disable comments on different post types or your entire site.

This plugin is clearly not as flexible as using code and most useful when removing comments for custom post types.

Delete, Remove & Turn Off Comments

If you want to delete comments, here’s a few tips about how to delete comments by date, remove comments in your spam queue and simply turn off comments.

Reader Interactions

Comments

  1. Andy says

    October 17, 2013 at 3:21 pm

    Did this change after Genesis 2.0? I added the code to remove comments from one specific category and it did not work. 🙁

    Log in to Reply
    • Brad Dalton says

      October 18, 2013 at 7:36 am

      Which code did you copy and what did you need it to do?

      Log in to Reply
  2. Anwar Hussain says

    June 4, 2013 at 11:57 am

    Hi! This is really nice post. I would like to know one more code for remove comment from all except multiple categories. This is because I have many categories but I want to remove show comment form in two or more categories. I am not sure but can this code works if ( !in_category( ’27’, ’23’,’56’ )

    Log in to Reply
    • Brad Dalton says

      June 5, 2013 at 7:04 am

      Hello Anwar

      You need to add an array like this:

      ! in_category( array( 27,23,56 ) ) ) {

      Hope that helps you Anwar

      Log in to Reply
      • Anwar Hussain says

        June 5, 2013 at 9:13 am

        Thanks for the code.. that works. One more question can this code work for single post to show certain things in all post from the categories except multiple categories:

        if ( is_single() && !in_category(array(11,12,13,14,26,4))) { ?>

        Log in to Reply
        • Brad Dalton says

          June 5, 2013 at 9:22 am

          You can add an array to the is_single(array(11,12,13,14,26,4))) { conditional tag so comments are removed only from specific posts.

          Did this answer your question or was it something else?

          Log in to Reply
          • Anwar Hussain says

            June 9, 2013 at 11:00 am

            Thanks Dalton for your help..

          • Brad Dalton says

            June 10, 2013 at 8:42 am

            No worries Anwar

Leave a Reply Cancel reply

You must be logged in to post a comment.

Primary Sidebar

Code written by Brad Dalton specialist for Genesis, WooCommerce & WordPress theme customization. Read More…

Advertise · WPEngine · Genesis · Log in

  • Access Problems
  • Account Details
  • Consulting
  • Tags
 

Loading Comments...
 

You must be logged in to post a comment.