Title: Multiple Orderby Not Working
Last modified: November 13, 2018

---

# Multiple Orderby Not Working

 *  [baldidiot](https://wordpress.org/support/users/baldidiot/)
 * (@baldidiot)
 * [7 years, 6 months ago](https://wordpress.org/support/topic/multiple-orderby-not-working/)
 * I’m trying to set up a shortcode that uses two sets of fields for the order –
   the reference guide says this is possible but it’s not working.
 * Two fields we want to order by:
 * 1. Radio button with options 1, 2 and 3
    2. Date
 * This is what I’m using but it’s not outputting any posts. If I remove the orderbey_2
   it works fine:
 * orderby=field key=positioning order=desc orderby_2=date order_2=desc

Viewing 4 replies - 1 through 4 (of 4 total)

 *  [Peter Berger](https://wordpress.org/support/users/peterpolow/)
 * (@peterpolow)
 * [7 years, 6 months ago](https://wordpress.org/support/topic/multiple-orderby-not-working/#post-10877467)
 * Try to define `key_2` and change `orderby_2=date` to `orderby_2=field_num`.
 * May be you also need `field_num` for “positionering”?
 * Peter
 *  Thread Starter [baldidiot](https://wordpress.org/support/users/baldidiot/)
 * (@baldidiot)
 * [7 years, 6 months ago](https://wordpress.org/support/topic/multiple-orderby-not-working/#post-10878953)
 * Thanks for the reply Peter.
 * Still doesn’t seem to be working – this is what I’m currently using:
 * [loop type=myposts orderby=field_num key=positioning order=desc orderby_2=field_num
   key_2=date order_2=desc]
 * It works as expected without the second parameter and also fine when only using
   the date parameter. It’s just combining them that doesn’t seem to be working.
    -  This reply was modified 7 years, 6 months ago by [baldidiot](https://wordpress.org/support/users/baldidiot/).
 *  [sheila888](https://wordpress.org/support/users/sheila888/)
 * (@sheila888)
 * [7 years, 2 months ago](https://wordpress.org/support/topic/multiple-orderby-not-working/#post-11270329)
 * Hi – did you ever get to the bottom of this problem?
 * I am also having the same issue:
 * [loop type=external_link taxonomy=page_location term={PAGE} orderby=sort_order
   orderby_2=title]
 * Either sort_order or title works fine with the orderby but adding the orderby_2
   stops it working.
 * Any help would be much appreciated!
 * Thanks
 * Sheila
    -  This reply was modified 7 years, 2 months ago by [sheila888](https://wordpress.org/support/users/sheila888/).
 *  Thread Starter [baldidiot](https://wordpress.org/support/users/baldidiot/)
 * (@baldidiot)
 * [7 years, 2 months ago](https://wordpress.org/support/topic/multiple-orderby-not-working/#post-11271692)
 * Unfortunately not. I ended up having to create the code for this shortcode in
   php.

Viewing 4 replies - 1 through 4 (of 4 total)

The topic ‘Multiple Orderby Not Working’ is closed to new replies.

 * ![](https://s.w.org/plugins/geopattern-icon/custom-content-shortcode_766976.svg)
 * [Custom Content Shortcode](https://wordpress.org/plugins/custom-content-shortcode/)
 * [Support Threads](https://wordpress.org/support/plugin/custom-content-shortcode/)
 * [Active Topics](https://wordpress.org/support/plugin/custom-content-shortcode/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/custom-content-shortcode/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/custom-content-shortcode/reviews/)

 * 4 replies
 * 3 participants
 * Last reply from: [baldidiot](https://wordpress.org/support/users/baldidiot/)
 * Last activity: [7 years, 2 months ago](https://wordpress.org/support/topic/multiple-orderby-not-working/#post-11271692)
 * Status: not resolved