I'm working on a website that uses WPL for translation. The website has 2 languages, french (main) and english. The problem I'm facing is that in a list of posts in the, english version, it's showing french posts. In these cases the posts have an english version but not published yet.
This is the query I make and how I loop through it:
<ul class="list-item list-inline list-posts clearfix">
<?php $args = array(
'post_type' => 'post',
'posts_per_page' => 12,
'post_status' => 'publish',
'orderby' => 'date',
'order' => 'DESC',
'suppress_filters' => false
);
if ($cat && !$tag):
$args['cat'] = $cat['term_id'];
endif;
if ($sector):
$args['cat'] = $sector['term_id'];
endif;
if ($tag):
$args['tag'] = $tag;
endif;
$query = new WP_Query($args);
if ($query->have_posts()):
while ($query->have_posts()): $query->the_post();
$args_cat = array(
'parent' => icl_object_id(3, 'category'),
);
$categories = wp_get_post_categories(get_the_ID(), $args_cat);
foreach ($categories as $cat_id) :
$category = get_category($cat_id);
endforeach;
if ($category->term_id == icl_object_id(8, 'category')): ?>
<li class="item circulation-alert-post table-cell">
<?php get_template_part('content', 'circulation');
else: ?>
<li class="item">
<?php get_template_part('content');
endif; ?>
</li>
<?php endwhile;
else:
get_template_part('content', 'none');
endif;
wp_reset_query(); ?>
</ul>
According to the WPML documentation the parameter 'suppress_filters' => false
should do the job, but it's not working.
Would anyone have some clues how I could fix this?
Thanks in advance.