Make WordPress Core

Opened 6 years ago

Closed 6 years ago

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

Download all attachments as: .zip

Change History (6)

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

@filosofo6 years ago

comment:2 @FFEMTcJ6 years ago

  • Milestone changed from Unassigned to 2.7.2

comment:3 @Viper007Bond6 years ago

  • Keywords has-patch added

comment:4 @ryan6 years ago

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

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

comment:5 @ryan6 years ago

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

Note: See TracTickets for help on using tickets.