I also ran into this issue. My query is a simple:
$events = new WP_Query( array(
'paged' => $current_page,
'posts_per_page' => $per_page,
'post_type' => 'tribe_events',
'post_status' => array( 'publish' ),
'meta_query' => array( array(
'key' => '_EventEndDateUTC',
'value' => date( 'Y-m-d', strtotime( 'today' ) ),
'compare' => '<',
'type' => 'DATE',
) ),
) );
I can suppress this error by stating 'suppress_filters' => true,
but that doesn’t seem right.
I’m getting a similar error when using the Beaver Builder plugin ( Premium edition) + Beaver Themer, but I found out that the error is actually coming from the TEC plugin’s Tribe__Events__Query::posts_orderby()
method. In our case, the fix was this filter code:
add_filter( 'tribe_query_can_inject_date_field', function( $can_inject, $query ) {
if ( 'tribe_events' == $query->query[ 'post_type'] ) {
return false;
}
return $can_inject;
}, 10, 2 );
Plugin Support
Jaime
(@jaimemarchwinski)
Hey there! Glad to hear that you have found a fix for your issue!
This thread has been inactive for a while so we’re going to go ahead and mark it Resolved. Please feel free to open a new thread if any other questions come up and we’d be happy to help. 🙂