Home Forums Event Espresso Premium Sort EEH_Event_Query by event name

Sort EEH_Event_Query by event name

Posted: June 1, 2017 at 8:45 am


June 1, 2017 at 8:45 am

I’m using EE4 and I’d like to sort my query by name.

I have a custom query using your recommended code to attach to the $wp_query call: $wp_query = new EE_Event_List_Query( $atts ); and everything is working fine except that I can’t sort by name.

The 'order_by' -> in $atts defaults to ORDER BY event_start_date in the query.

I found the function in the core file that parses the ‘order_by’ field here:

Unfortunately, I see that the only sorting options are ticket and venue related.

Is there a way to add another ‘case’ to this function to sort by event name without modifying a core file? Or maybe there’s another approach to sort this query by name that I haven’t considered.


  • Support Staff

June 1, 2017 at 1:50 pm

Hi there,

EE_Event_List_Query was actually deprecated. A few options you can consider would be to use the EventListQuery class with your own attributes, or you can use the WP_Query without the extended class.

If you can post some example code in a gist or pastebin I can give you more specific examples on what to change there.


June 2, 2017 at 12:12 pm

Thanks Josh!

Here’s a link to the code:

Let me know what you recommend.


  • Support Staff

June 6, 2017 at 12:03 pm

Here’s one idea that uses WP_Query instead:

The support post ‘Sort EEH_Event_Query by event name’ is closed to new replies.

Have a question about this support post? Create a new support post in our support forums and include a link to this existing support post so we can help you.

Event Espresso