Hi there,
Just wanted to follow up on this – https://theeventscalendar.com/support/forums/topic/debugging-ajax/ – which actually WASN’T solved by changing the ‘Recurring event instances’ setting in admin.
Unchecking that setting merely shifted the problem. Now, when there’s a date search, recurrences were being shown as desired. However, when a keyword search was done, recurrences were being shown – whereas we want recurrences to be hidden in that case. Again, this was just AJAX requests – after an AJAX call, if the page was manually refreshed, the query vars returned everything as desired.
So the issue here is that on AJAX requests, overriding ‘tribeHideRecurrence’ using pre_get_posts doesn’t appear to work.
The solution I’ve found is simple I guess – override the option using the filter for getting an option value:
add_filter( 'tribe_get_option', 'yh_tribe_get_recurrence_option', 99999, 3 );
function yh_tribe_get_recurrence_option( $value, $option_name, $default ) {
if ( $option_name == 'hideSubsequentRecurrencesDefault' ) {
$value = ! YH_EVENTS_SHOWING_RECURRENCES;
}
return $value;
}
Seems to work so far.
So as far as I can tell this is a genuine bug, but I guess even when you fix it, the above hack will carry on working OK.