megwoo
6/24/2015 - 5:16 AM

WordPress Exclude Category

post loop:

<?php 
	// exclude category from main loop
	query_posts($query_string . '&cat=-6'); 
?>
<?php while ( have_posts() ) : the_post(); ?>

<?php endwhile; ?>


add to functions.php to remove from category sidebar:

<?php
  function exclude_widget_categories($args)
  {
    $exclude = "6"; // The IDs of the excluding categories
    $args["exclude"] = $exclude;
    return $args;
  }
  add_filter("widget_categories_args","exclude_widget_categories");
?>