Hi, Stephen,
Some time ago you gave me a function to use so that events with a specific tag (in this case,
“Upcoming Events”) that were occurring now or later would display sorted by their start date in
ascending order.
With the update to Event Organiser (one of the updates past version 1.7, I believe), past events are
now displaying and they are no longer sorting in order.
Here’s the function: add_action( 'pre_get_posts', 'shahn1234_group_occurrences' );
function shahn1234_group_occurrences( $query ){
if( defined( 'EVENT_ORGANISER_DIR' ) && eventorganiser_is_event_query( $query )
&& $query->is_main_query()
&& is_tax( 'event-tag' ) ){
$query->set( 'group_events_by', 'series' );
$query->set( 'event_start_after', 'now' );
}
}
The web page is http://www.ashevillemeditation.com/events/tag/upcoming-events
Do you have any idea why this might be happening?
Thanks,
Suzanne

Ronya Banks
Hi Suzanne,
That snippet is still correct, so it should still work. Furthermore there haven’t been any changes to the relevant part of the codebase in over year. That doesn’t rule out a bug in the plugin but coupled with the fact this is a significant issue that hasn’t been previously reported I think the issue might be a conflict with another plugin.
One thing I noticed is that the page doesn’t display any dates. This might bd relevant. Are you using a custom template?

Stephen Harris
Hi, Stephen,
I just want to update with the solution I found in case it’s useful to you or to anyone else.
I checked theme and plugin conflicts but this did not resolve the problem. I was using a
custom template so I tried reverting to your events/tags template, but the problem with dates
no longer appearing, incorrect sort order, and past events displaying continued.
I ended up adding the following line to the function I mentioned above, and it resolved everything:
$query->set( 'post_type', array( 'event' ) );

Ronya Banks