听起来你想从你的issue_filter
分类学要做到这一点,您需要使用get_terms()
with a few arguments.
$t = get_terms(
\'issue_filter\',
array(
\'orderby\' => \'id\',
\'order\' => \'DESC\',
\'number\' => 1,
\'fields\' => \'ids\'
)
);
这应该会得到最近创建的术语,其内容为ID数组。你的
tax_query
will accept that array 原来如此,所以。。。
$the_query = new WP_Query(
array(
\'post_type\' => \'news\',
\'posts_per_page\' => \'-1\',
\'tax_query\' => array(
array(
\'taxonomy\' => \'issue_filter\',
\'field\' => \'slug\',
\'terms\' => $t
)
)
)
);