Hiding a category from recently published posts in WordPress

To hide a category and its posts from recent posts:

  1. Get the category id(s), (for example 3)
  2. Find index.php
  3. Paste the following code just before *’THE LOOP’.


    <?php query_posts(‘cat=-3’); ?>

    Note: Please take a backup of your index.php before doing this.

*THE LOOP: Although it may differ in some cases, the basic loop would look like this –

<?php if (have_posts()) : while (have_posts()) : the_post(); ?>



Leave a Comment

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