[wp-trac] [WordPress Trac] #19833: can not sort by 2 custom fields

WordPress Trac wp-trac at lists.automattic.com
Sun Jan 15 01:19:16 UTC 2012


#19833: can not sort by 2 custom fields
--------------------------+-------------------------------
 Reporter:  zied86        |       Owner:  zied86@…
     Type:  defect (bug)  |      Status:  closed
 Priority:  normal        |   Milestone:
Component:  Query         |     Version:  3.3.1
 Severity:  blocker       |  Resolution:  duplicate
 Keywords:                |
--------------------------+-------------------------------
Description changed by scribu:

Old description:

> Hello
> I followed the syntax of the codex to sort by two criteria of custom
> fields, but unfortunately it does not work[[BR]]
>
> http://codex.wordpress.org/Class_Reference/WP_Query#Order_.26_Orderby_Parameters[[BR]]
>
> It accepts only one custom field[[BR]]
>
> $args = array(
> 'post_type' => 'post_type',
> 'posts_per_page' => '20',
> 'orderby' => 'custom_field1 custom_field2',
> 'order' => 'ASC');
> [[BR]]
>
> $query = new WP_Query( $args );
> [[BR]]
>
> thank you

New description:

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

--

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


More information about the wp-trac mailing list