[wp-trac] [WordPress Trac] #16967: Adding cat=-# removes sorting

WordPress Trac wp-trac at lists.automattic.com
Sat Mar 26 00:24:51 UTC 2011


#16967: Adding cat=-# removes sorting
-------------------------------------+------------------------------
 Reporter:  jdingman                 |       Owner:  scribu
     Type:  defect (bug)             |      Status:  reviewing
 Priority:  normal                   |   Milestone:  Awaiting Review
Component:  Query                    |     Version:  3.1
 Severity:  normal                   |  Resolution:
 Keywords:  reporter-feedback close  |
-------------------------------------+------------------------------
Changes (by aaroncampbell):

 * keywords:  reporter-feedback => reporter-feedback close


Comment:

 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
 }}}

-- 
Ticket URL: <http://core.trac.wordpress.org/ticket/16967#comment:3>
WordPress Trac <http://core.trac.wordpress.org/>
WordPress blogging software


More information about the wp-trac mailing list