Posted By

crs on 10/08/09


Tagged

wordpress archive exclude


Versions (?)

Exclude Categories from the archive pages


 / Published in: PHP
 

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

  1. add_action('pre_get_posts', 'gloss_remove_glossary_cat' );
  2.  
  3. function gloss_remove_glossary_cat( $notused )
  4. {
  5. global $wp_query;
  6. global $gloss_category;
  7.  
  8. // Figure out if we need to exclude glossary - exclude from
  9. // archives (except category archives), feeds, and home page
  10. if( ( is_archive() )) {
  11. $wp_query->query_vars['cat'] = '-108,-18' . $gloss_category;
  12. }
  13. }

Report this snippet  

You need to login to post a comment.