Answer the question
In order to leave comments, you need to log in
WP_Query categories filtering does not work when switching to the en version. Why can wp ignore categories?
Worth the WPML plugin.
And there are sections with lang=en and lang=ru
artcenter.ru/news - ru work fine
artcenter.ru/en/news - en don't work, but the query is built without them.. as if WP_Query doesn't see them The
request is:
$attr_id = explode(",", $str_attr);
$news = new WP_Query(array(
'suppress_filters' => 'FALSE',
'orderby' => 'date',
'order' => 'DESC',
'post_type' => 'post',
'category__in' => $attr_id
));
Answer the question
In order to leave comments, you need to log in
Because most likely your var_dump($attr_id) is empty when you switch to English. And this happens because in wpml (as far as I know) categories are independent for different languages. That is, visually the same category can have two different entities in the database (and therefore different id). That is, English categories simply do not fall into your $attr_id selection.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question