Title: Sort Returned Query
Last modified: February 2, 2018

---

# Sort Returned Query

 *  Resolved [amddtim](https://wordpress.org/support/users/amddtim/)
 * (@amddtim)
 * [8 years, 6 months ago](https://wordpress.org/support/topic/sort-returned-query/)
 * Is there a hook that would allow me to sort/reorder a return ALM query before
   it’s looped through? I need to do some complex sorting that a WP query can’t 
   handle, eg, using the title of a post to sort by last name, or, ordering posts
   by taxonomy term.

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

 *  Plugin Author [Darren Cooney](https://wordpress.org/support/users/dcooney/)
 * (@dcooney)
 * [8 years, 6 months ago](https://wordpress.org/support/topic/sort-returned-query/#post-9931672)
 * Hi [@amddtim](https://wordpress.org/support/users/amddtim/),
 * There is not a filter for sorting the actual returned data… Though that might
   be a helpful filter.
 * As you likely know, all you can do currently is use the alm_query_args filter.
   
   [https://connekthq.com/plugins/ajax-load-more/docs/filter-hooks/#alm_query_args](https://connekthq.com/plugins/ajax-load-more/docs/filter-hooks/#alm_query_args)
 *  Thread Starter [amddtim](https://wordpress.org/support/users/amddtim/)
 * (@amddtim)
 * [8 years, 6 months ago](https://wordpress.org/support/topic/sort-returned-query/#post-9932667)
 * Ah, bummer. Yeah that would be super helpful and I’d love to see it in a release
   soon. I know about and am using the alm_query_args filter in other situations,
   but like I said, the sorting capability I need is too advanced for the WP_Query.
 *  Plugin Author [Darren Cooney](https://wordpress.org/support/users/dcooney/)
 * (@dcooney)
 * [8 years, 6 months ago](https://wordpress.org/support/topic/sort-returned-query/#post-9932826)
 * Yea, makes sense I think.
 * I just don’t fully understand a use case for sorting posts like this unless you
   are returning all posts.
 * Say someone loads 10 posts of 60, sorts them before display… then they load 10
   more and sort those… What type of order would the results be in?
 * Anyways, just curious.
 *  Thread Starter [amddtim](https://wordpress.org/support/users/amddtim/)
 * (@amddtim)
 * [8 years, 6 months ago](https://wordpress.org/support/topic/sort-returned-query/#post-9939895)
 * Fair point, but I am returning all the posts I need for a carousel. No ‘scroll’
   loading. Eg, I’m getting all the speakers for the year 2018, but I need those
   speakers ordered by taxonomy terms and then by last name.
 * Overall, I’m using the ALM plugin to have the initial page load go faster and
   for the filtering abilities.
    -  This reply was modified 8 years, 6 months ago by [amddtim](https://wordpress.org/support/users/amddtim/).

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

The topic ‘Sort Returned Query’ is closed to new replies.

 * ![](https://ps.w.org/ajax-load-more/assets/icon-256x256.png?rev=2944639)
 * [Ajax Load More – Infinite Scroll, Load More, & Lazy Load](https://wordpress.org/plugins/ajax-load-more/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/ajax-load-more/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/ajax-load-more/)
 * [Active Topics](https://wordpress.org/support/plugin/ajax-load-more/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/ajax-load-more/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/ajax-load-more/reviews/)

 * 4 replies
 * 2 participants
 * Last reply from: [amddtim](https://wordpress.org/support/users/amddtim/)
 * Last activity: [8 years, 6 months ago](https://wordpress.org/support/topic/sort-returned-query/#post-9939895)
 * Status: resolved