AJAX requests not respecting pre_get_posts overrides to show recurrence setting

Home Forums Calendar Products Events Calendar PRO AJAX requests not respecting pre_get_posts overrides to show recurrence setting

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #998697
    Steve
    Participant

    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.

    #999755
    George
    Participant

    Hey Mike,

    I’m sorry that you had to do some digging of your own to get things working as you hoped. However, we greatly appreciate you sharing this fix and it’s something we can investigate a bit more closely before the next-next release (I say “next-next” because the next is coming super soon 😉 ).

    Thank you! Stay tuned to the upcoming releases and read their changelogs for notes about improvements here.

    — George

Viewing 2 posts - 1 through 2 (of 2 total)
  • The topic ‘AJAX requests not respecting pre_get_posts overrides to show recurrence setting’ is closed to new replies.