Return to Snippet

Revision: 18791
at October 8, 2009 10:32 by crs


Initial Code
add_action('pre_get_posts', 'gloss_remove_glossary_cat' );

function gloss_remove_glossary_cat( $notused )
{
  global $wp_query;
  global $gloss_category;

  // Figure out if we need to exclude glossary - exclude from
  // archives (except category archives), feeds, and home page
  if( ( is_archive() )) {
     $wp_query->query_vars['cat'] = '-108,-18' . $gloss_category;
  }
}

Initial URL

                                

Initial Description
the numbers 108 and 18 are the category ids i wanted to exclude

Initial Title
Exclude Categories from the archive pages

Initial Tags
wordpress

Initial Language
PHP