Make WordPress Core

Opened 7 years ago

Closed 7 years ago

Last modified 7 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 7 years ago.

Download all attachments as: .zip

Change History (6)

comment:1 @filosofo7 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.

@filosofo7 years ago

comment:2 @FFEMTcJ7 years ago

  • Milestone changed from Unassigned to 2.7.2

comment:3 @Viper007Bond7 years ago

  • Keywords has-patch added

comment:4 @ryan7 years ago

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

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

comment:5 @ryan7 years ago

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

Note: See TracTickets for help on using tickets.