WPML: WP_Query + suppress_filters not working


I’m working on a fix to a WordPress multi-language site using WPML.
This website has two different domains, one for english and one for french. French is the main language.

For all the website when I retrieve posts the language of the website is respected in the query, but there is a query in the theme’s footer.php, to retrieve some alerts, which is returning posts in any language. this is the query:

$args = array(
    'post_type' => 'post',
    'cat' => 8,
    'posts_per_page' => 1,
    'meta_key' => 'traffic-level',
    'meta_value' => 1,
    'suppress_filters' => false

$query = new WP_Query( $args );

if( $query->have_posts() ):

    while( $query->have_posts() ) : $query->the_post();?>

     print the post...

    <?php endwhile;


In all the other pages suppress_filters' => false is not set. I added this because I saw it in the plugin’s forum but it’s not working properly yet. I also checked my functions.php to see if there was a pre_get_posts action that could be messing with the query and there isn’t.

Am I missing something in this query? What else could I do to fix it?

Thanks for any help

Andre Luiz 12 months 2020-03-11T12:51:43-05:00 0 Answers 136 views 0

Leave an answer