#16967 closed defect (bug) (duplicate)
Adding cat=-# removes sorting
Reported by: |
|
Owned by: |
|
---|---|---|---|
Milestone: | Priority: | normal | |
Severity: | normal | Version: | 3.1 |
Component: | Query | Keywords: | |
Focuses: | Cc: |
Description (last modified by )
When adding in cat=-20, it stops sorting
$my_query = new WP_Query('cat=-20&posts_per_page=10&orderby=date&order=DESC');
when I run it like this:
$my_query = new WP_Query('posts_per_page=10&orderby=date&order=DESC');
it works like I expect it will.
I tested it in the array format as well, and adding category__not_in
removes the sorting I add to it
Change History (8)
#1
@
14 years ago
- Description modified (diff)
- Owner set to scribu
- Status changed from new to reviewing
#3
@
14 years ago
- Keywords close added
I also can't reproduce. Here's some test code I used:
$my_query = new WP_Query('posts_per_page=10&orderby=date&order=DESC'); if ( $my_query->have_posts() ) { echo "<h2>Without Cat=-###</h2>"; while ( $my_query->have_posts() ) { $p = $my_query->next_post(); echo $p->post_date . " : " . $p->post_title . "<br />\r\n"; } } $my_query = new WP_Query('cat=-679&posts_per_page=10&orderby=date&order=DESC'); if ( $my_query->have_posts() ) { echo "<h2>With Cat=-### DESC</h2>"; while ( $my_query->have_posts() ) { $p = $my_query->next_post(); echo $p->post_date . " : " . $p->post_title . "<br />\r\n"; } } $my_query = new WP_Query('cat=-679&posts_per_page=10&orderby=date&order=ASC'); if ( $my_query->have_posts() ) { echo "<h2>With Cat=-### ASC</h2>"; while ( $my_query->have_posts() ) { $p = $my_query->next_post(); echo $p->post_date . " : " . $p->post_title . "<br />\r\n"; } }
And my output with some test data on a trunk site looked like this:
Without Cat=-### 2010-01-01 11:26:08 : Sample Post With Threaded Comments 2010-01-01 11:25:48 : Sample Post With Image Aligned Left 2010-01-01 11:25:27 : Sample Post With Image Aligned Right 2010-01-01 11:24:48 : Sample Post With Image Centered 2010-01-01 11:24:24 : Sample Post With an Unordered List 2010-01-01 11:24:00 : Sample Post With an Ordered List 2010-01-01 11:19:49 : Sample Post With a Blockquote 2010-01-01 01:19:42 : Sample Post With Headlines 2009-07-06 15:57:15 : Test Attachments 2009-06-22 13:12:29 : Caption issue With Cat=-### 2009-07-06 15:57:15 : Test Attachments 2009-06-22 13:12:29 : Caption issue 2009-06-14 11:10:15 : Test Post 2 2009-06-14 11:09:52 : test post 1 2009-06-14 11:06:11 : Hello world! 2009-05-06 11:03:15 : Map Test With Cat=-### 2009-05-06 11:03:15 : Map Test 2009-06-14 11:06:11 : Hello world! 2009-06-14 11:09:52 : test post 1 2009-06-14 11:10:15 : Test Post 2 2009-06-22 13:12:29 : Caption issue 2009-07-06 15:57:15 : Test Attachments
#4
@
14 years ago
Couldn't reproduce when I tested earlier. On IRC the OP said no plugins enabled whilst he was testing.
#6
@
14 years ago
- Resolution set to duplicate
- Status changed from reviewing to closed
See http://core.trac.wordpress.org/ticket/16812#comment:9
Patch on #16826 seems to solve this problem
Note: See
TracTickets for help on using
tickets.
Can't reproduce it.