已格式化为可读的查询参数如下所示:
$args = array(
\'taxonomy\' => $taxonomy,
\'term\' => $term->slug,
\'posts_per_page\' => 1,
\'orderby\' => \'modified\',
\'category\' => $str
);
这与我看到的任何参数模式都不匹配
WP_Query. 我想你是在试图构建一个
tax_query 但应该是这样的:
$args = array(
\'tax_query\' => array(
array(
\'taxonomy\' => $taxonomy,
\'field\' => \'slug\',
\'terms\' => $term->slug
)
),
\'posts_per_page\' => 1,
\'ignore_sticky_posts\' => true,
\'orderby\' => \'modified\',
\'category\' => $str
);
我不知道你为什么有
tax_query 和a
category 论点也许这是个错误,也许你想
AND 或
OR 分类法之间的关系。我不确定。
我怀疑你也想要ignore_sticky_posts 所以我加了一句。