Make WordPress Core

Opened 9 years ago

Closed 9 years ago

Last modified 9 years ago

#9228 closed defect (bug) (fixed)

query_posts orderby=category uses posts post_category field instead of terms table

Reported by: MichaelH Owned by:
Milestone: 2.7.2 Priority: normal
Severity: normal Version: 2.7.1
Component: Template Keywords: has-patch
Focuses: Cc:


The query_posts 'orderby=category' still uses the posts table field 'post_category' instead of terms table.

This query:

<?php query_posts('showposts=-1&orderby=category&order=DESC'); ?>

generates this MySQL SELECT statement:

SELECT wp_posts.* FROM wp_posts WHERE 1=1 AND wp_posts.post_type = 'post' AND (wp_posts.post_status = 'publish' OR wp_posts.post_status = 'private') ORDER BY wp_posts.post_category DESC

Attachments (1)

no_cat_order.9228.diff (635 bytes) - added by filosofo 9 years ago.

Download all attachments as: .zip

Change History (6)

#1 @filosofo
9 years ago

Since posts can have multiple categories, there's not a good way this could work. And since this hasn't been working since 2.0.x, I don't think it will be missed. Let's get rid of it.

9 years ago

  • Milestone changed from Unassigned to 2.7.2

#3 @Viper007Bond
9 years ago

  • Keywords has-patch added

#4 @ryan
9 years ago

  • Resolution set to fixed
  • Status changed from new to closed

(In [10779]) Remove category ordering. Props filosofo. fixes #9228

#5 @ryan
9 years ago

(In [10780]) Remove category ordering. Props filosofo. fixes #9228 for 2.7

Note: See TracTickets for help on using tickets.