[wp-testers] Category Exclusion and 2.7-almost-beta

DD32 wordpress at dd32.id.au
Sat Oct 18 23:55:53 GMT 2008


While i think cat is converted to this, You might want to have a look into  
'category__not_in' and see if that works for you

On Sun, 19 Oct 2008 08:53:46 +1100, Christopher Weddell  
<christopherweddell at googlemail.com> wrote:

> Long time viewer - first time poster...
>
> Recently I have been wanting to exclude posts in certain categories
> from everywhere but admin and single views - so I added this to
> functions.php
>
> // Hide category 5 from site (except admin, and single views)
>
> add_action('pre_get_posts', 'remove_sold_cat' );
>
> function remove_sold_cat() {
>   global $wp_query;
> if (is_admin() || is_single() ) {
> } else {
> 	$wp_query->query_vars['cat'] = '-5';
> }
> }
>
> I did not work as expected in 2.6 (posts in more than one category ie
> 1 & 5 would still appear in category archives for cat 1 listings) -
> cry for help here: http://wordpress.org/support/topic/209915
>
> So I thought I would try 2.7-almost-beta...
> Category archives now look totally screwed as while cat 5 posts are
> hidden in the category archive for cat 1 I am getting cat 1, 2, 3 and
> 4 posts showing - in fact whatever category archive I look at I get
> posts from all categories appearing (except for cat 5 - which is
> better than with 2.6!).  Plus when I look at the category archive for
> cat 5 I don't see posts from cat 5 but I do see posts from cat 1, 2,
> 3, and 4.
>
> Clean & fresh install of 2.7-almost-beta, no plugins installed and the
> same things happen if using default or classic theme.
>
> Any thoughts?
> Cheers
> Christopher
> _______________________________________________
> wp-testers mailing list
> wp-testers at lists.automattic.com
> http://lists.automattic.com/mailman/listinfo/wp-testers
>




More information about the wp-testers mailing list