如何将语言参数设置为WP_Query

时间:2017-07-27 11:35:23

标签: php wordpress

如何在WP_query中为过滤器语言设置语言参数? 'suppress_filters' => 0无效。

$query = new WP_Query(array(
    'post_type' => 'apre_restaurants',
    'posts_per_page' => -1,
    'post_status' => 'publish'
));

1 个答案:

答案 0 :(得分:0)

尝试以下脚本

$args = array( 'posts_per_page' => -1, 'tax_query' => array( array( 'taxonomy' => 'include custom taxonomy name', 'field' => 'id', 'terms' => function_exists('icl_object_id')?icl_object_id($categoryID,'include custom taxonomy name',false):$categoryID ) ), 'suppress_filters' => 0 ); //(do not forget 'suppress_filters' => 0) :)