我可以看出你想说得很清楚,但这仍然是一个令人困惑的问题,让我的大脑有点崩溃。我想这可能会达到你想要的,但我不能完全确定我是否正确理解你。无论如何,请尝试一下,它可能会起作用,也可能不会起作用:
$downloads_parent_posts = get_posts( array(
\'post_type\' => \'downloads\',
\'orderby\' => \'title\',
\'order\' => \'ASC\',
\'tax_query\' => array(
\'relation\' => \'AND\',
array(
\'taxonomy\' => \'download-category\',
\'terms\' => $term->term_id,
\'field\' => \'term_id\',
\'include_children\' => false
),
array(
\'taxonomy\' => \'download-category\',
\'terms\' => get_term_children($term->term_id, $term->taxonomy),
\'field\' => \'term_id\',
\'operator\' => \'NOT IN\',
)
),
) );