[wp-hackers] Exclude Categories From The Loop
otto at ottodestruct.com
Fri Oct 5 15:18:58 GMT 2007
On 10/5/07, Paul Menard <paul at codehooligans.com> wrote:
> function myHomePostsFilter($query)
> if ($query->is_home)
> return $query;
Paul has the correct answer here, this is the cleanest way to do it.
It will filter the categories in exactly the way you like. I would set
the 'category__in' and 'category__not_in' query variables. They're new
to 2.3, but they're very easy to use.
$query->set('category__not_in','1,2,3,4') and such.
More information about the wp-hackers