WordPress.org

Make WordPress Core

Opened 17 months ago

Closed 17 months ago

Last modified 17 months ago

#19833 closed defect (bug) (duplicate)

can not sort by 2 custom fields

Reported by: zied86 Owned by: zied86@…
Priority: normal Milestone:
Component: Query Version: 3.3.1
Severity: blocker Keywords:
Cc: zied86@…

Description (last modified by scribu)

Hello
I followed the syntax of the codex to sort by two criteria of custom fields, but unfortunately it does not work.

http://codex.wordpress.org/Class_Reference/WP_Query#Order_.26_Orderby_Parameters

It accepts only one custom field:

$args = array(
'post_type' => 'post_type',
'posts_per_page' => '20',
'orderby' => 'custom_field1 custom_field2',	
'order' => 'ASC');

$query = new WP_Query( $args );

Change History (2)

comment:1 scribu17 months ago

  • Milestone Awaiting Review deleted
  • Resolution set to duplicate
  • Status changed from new to closed

comment:2 scribu17 months ago

  • Description modified (diff)
Note: See TracTickets for help on using tickets.