Title: Multiple Column Ordering
Last modified: October 9, 2017

---

# Multiple Column Ordering

 *  Resolved [wohlstadterewg](https://wordpress.org/support/users/wohlstadterewg/)
 * (@wohlstadterewg)
 * [8 years, 8 months ago](https://wordpress.org/support/topic/multiple-column-ordering/)
 * Does Relevanssi support sorting on multiple columns? My understanding is that
   the WP_Query supports passing multiple columns in the format of:
 * ‘orderby’ => array(‘columna’ => ‘ASC’, ‘columnb’ => ‘DESC’)
 * However, Relevanssi seems to be expecting a string for the ‘orderby’ option.
 * Thanks,
    Michael

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

 *  Plugin Author [Mikko Saari](https://wordpress.org/support/users/msaari/)
 * (@msaari)
 * [8 years, 8 months ago](https://wordpress.org/support/topic/multiple-column-ordering/#post-9571633)
 * Correct – Relevanssi pretty much fails if you try to pass an array in `orderby`.
   I just recently learnt that it’s legal to pass an array there…
 * I’m going to fix that in the next version so that Relevanssi supports the array
   format, but I’m not sure whether Relevanssi will support multiple column sorting
   or not. When searching, it’s not that useful to sort by multiple columns.
 * If you need multiple column sorting, I’d be interested in hearing what kind of
   use case you have in mind.
 *  Plugin Author [Mikko Saari](https://wordpress.org/support/users/msaari/)
 * (@msaari)
 * [8 years, 8 months ago](https://wordpress.org/support/topic/multiple-column-ordering/#post-9571756)
 * Actually, implementing the multi-level sorting wasn’t particularly difficult.
   From the next version on, Relevanssi will support array orderby, with multiple
   levels of sorting. Relevanssi will also cover a much larger number of possible
   sort options in WordPress – not everything, but almost.
 * If you want to test this, drop me an email to [mikko@mikkosaari.fi](https://wordpress.org/support/topic/multiple-column-ordering/mikko@mikkosaari.fi?output_format=md),
   and I’ll give you a preview.
 *  Thread Starter [wohlstadterewg](https://wordpress.org/support/users/wohlstadterewg/)
 * (@wohlstadterewg)
 * [8 years, 8 months ago](https://wordpress.org/support/topic/multiple-column-ordering/#post-9573274)
 * Thanks for the fast response!
 * My use case is that we have a library of files (documents, spreadsheets, maps,
   etc.) that we are using Relevanssi to search. For the most part, sorting by relevance
   is all that is required. However, in some cases two or more documents have the
   same relevance score. In those cases we would like the documents sorted by the
   secondary key, title.
 * I am interested in the preview and will email you.
 * Thanks again,
    Michael
    -  This reply was modified 8 years, 8 months ago by [wohlstadterewg](https://wordpress.org/support/users/wohlstadterewg/).

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

The topic ‘Multiple Column Ordering’ is closed to new replies.

 * ![](https://ps.w.org/relevanssi/assets/icon-256x256.png?rev=3529670)
 * [Relevanssi - A Better Search](https://wordpress.org/plugins/relevanssi/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/relevanssi/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/relevanssi/)
 * [Active Topics](https://wordpress.org/support/plugin/relevanssi/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/relevanssi/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/relevanssi/reviews/)

## Tags

 * [array](https://wordpress.org/support/topic-tag/array/)
 * [orderby](https://wordpress.org/support/topic-tag/orderby/)

 * 3 replies
 * 2 participants
 * Last reply from: [wohlstadterewg](https://wordpress.org/support/users/wohlstadterewg/)
 * Last activity: [8 years, 8 months ago](https://wordpress.org/support/topic/multiple-column-ordering/#post-9573274)
 * Status: resolved