tribe_suppress_query_filters doesn’t work
-
Hi! One of our customers uses Events Calendar, and I’m trying to ask down the events by using get_posts, and the ordering has to be based on a meta_key. The meta_key ordering does not work, because some code from your plugin overwrites the query. I tried to use tribe_suppress_query_filters to avoid the issue, but that did not work. Example:
$args = array(
'post_type' => 'tribe_events',
'posts_per_page' => 5,
'meta_key' => '_edit_last',
'orderby' => 'meta_value_num',
'order' => 'ASC',
);
add_filter('tribe_suppress_query_filters', function(){ return true; });
$events = get_posts($args);
foreach($events AS $event){
var_dump(get_post_meta($event->ID, '_edit_last', true));
}The ordering doesn’t works with tribe_events post type, but it does with other post types. Result at our customer:
string(2) "12"
string(2) "16"
string(2) "14"
string(1) "1"
string(1) "1"Could you tell me why, or is this a bug?
Some additional info from the debugging:
If I check the last query after get_posts:$events = get_posts($args);
global $wpdb;
var_dump($wpdb->last_query);then it will be this:
string(104) "SELECT *
FROM[prefix]_tec_occurrences
WHERE (occurrence_idIN (827,834,862,863,866))
LIMIT 50
OFFSET 0"What I would expect:
string(209) "SELECT [prefix]_posts.ID FROM [prefix]_posts WHERE ...."So I don’t want any Events Calendar queries or query modifications to run, only get_posts in its native state.
The topic ‘tribe_suppress_query_filters doesn’t work’ is closed to new replies.