[wp-hackers] exclude category from main loops via plugin

Alexander Höreth a.hoereth at gmail.com
Mon Dec 13 13:03:24 UTC 2010


Hey there,
I am working on a plugin which needs to exclude a post category from 
main loops. E.g. the loop processed on the index page but as well from 
archives etc.
Normally I would use
<?php query_posts($query_string . '&category_name=-mycategory'); ?>
directly in the theme files.
How do I add it using hooks?
loop_start, parse_query or pre_get_posts?
I already tried adding it, but it just killed the website..

Thanks already!


More information about the wp-hackers mailing list