Remove Specific category From The Loop in WordPress


In this tutorial we are going to discuss Remove Specific category From The Loop in WordPress.

The area inner the while loop could be whatever, that’s just some sample, typical within-loop code. The code is the first line, and the cat=-3 parameter. -3 in this case is the ID of the category, and you can swap that with any category which you wish to pull out from the loop. You may use comma (,) separated values here to pull out more than 1 category (e.g. cat=-1,-2).

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

<?php if (have_posts()) : ?>
<?php while (have_posts()) : the_post(); ?>
  <p><?php the_time('F jS, Y') ?></p>
  <?php the_content(); ?>
<?php endwhile; ?>

Like it? Share with your friends!