Check if query_string has something in it first.
If you’re passing in an empty string(you might be), then you end up with a malformed query string which looks like..
&cat=47
Hi t31os_, thanks for the reply.
I have check variable $query_string is empty.
FYI, if I use query_posts("cat=-47"); it’s still can not exclude category_ID=47 from the loop.
How to solve this problem?
Maybe try as an array then..
query_posts( array( 'cat' => '-47' ) );
Or even with single quotes instead (not that it should make a difference)..
query_posts( 'cat=-47' );
Or just switch to category__not_in instead.
query_posts( array( 'category__not_in' => array( 47 ) ) );
http://codex.ww.wp.xz.cn/Function_Reference/query_posts#Category_Parameters
Hi t31os_, thanks for your explanation.
query_posts( array( 'cat' => '-47' ) );
and
query_posts( 'cat=-47' );
Both not work.
It work with
query_posts( array( 'category__not_in' => array( 47 ) ) );
Why in my case query_posts does not recognize minus sign? Is this problem with my database or with my query.php/classes.php? Is this typical of WPMU that can not exclude posts in query_posts?
Any way, my problem is solved event it remaining some questions.
Not sure why it’s not working, however the cat parameter passes it values onto category__in and category__not_in anyway, so it’s perfectly fine to use them in place of cat.
Eg.
query_posts('cat=-1'); is the same as query_posts(array('category__not_in' => '-1'));
query_posts('cat=1'); is the same as query_posts(array('category__in' => '1'));
query_posts('cat=-1,2'); is the same as query_posts(array('category__not_in' => '-1','category__in'=>'2'));