Hide Specific Category Posts at Home page

To hide specific category posts at home page simply place this below single line code before the main loop start at home page.

<?php if ( is_home() ) {query_posts( 'cat=-1' ); } ?>

Complete loop with this above code will look like:

<?php if ( is_home() ) {query_posts( 'cat=-1' ); } ?>
  <?php if ( have_posts() ) : ?>
    <?php while ( have_posts() ) : the_post(); ?>
     <!-- Your stuff goes here -->
    <?php endwhile; ?>
  <?php endif; ?>

To hide multiple category posts at home page, use this below code before the main loop start:

<?php if ( is_home() ) {query_posts( 'cat=-1,-2,-3' ); } ?>

Leave a Reply

Your email address will not be published. Required fields are marked *

Solve : *
17 + 24 =