我已经安装了主题,我想在循环发布帖子之前向查询添加新的查询参数。
我正在尝试添加条款WHERE IN
。
$arg = ['relation' => 'AND', 'field' => 'ID', 'terms' => [1123], 'operator' => 'IN'];
这是我尝试未成功的尝试:
global $wp_query;
$arg = ['relation' => 'AND', 'field' => 'ID', 'terms' => [1123], 'operator' => 'IN'];
$wp_query->tax_query->queries[] = $arg;
$wp_query->query_vars['tax_query'] = $wp_query->tax_query->queries;
query_posts($wp_query);
if (have_posts()) ...