[Resolved] Consider checking DOING_AJAX for is_admin checks
Whilst building a custom addon to your plugin I came across an interesting problem whereby ajax calls on tribe_get_events() were not correctly filtering on the start_date and end_date criteria given.
I was able to track this down to TribeEventsQuery::setupQuery where is_admin() is checked before crucial add_filter(s) that enable these arguments to be correctly filtered. The problem is, calls from admin_ajax.php make all checks on is_admin() return true.
I was able to make this work by altering the conditional on line 18 of lib/tribe-event-query.class.php from:
if ( !is_admin() && (
if ( (!is_admin() || ( defined('DOING_AJAX') && DOING_AJAX ) ) && (
Obviously not the best way to get around the issue considering it will be overwritten next time the plugin is updated, however perhaps you might consider adding this into a future version. And perhaps doing the same for any similar functions in other areas of the plugin I have not come across.
- The topic ‘[Resolved] Consider checking DOING_AJAX for is_admin checks’ is closed to new replies.