你今天有各种有趣的问题!还有一个WP_Term_Query
在WordPress中提供。这里有一些关于它的信息以及可以传递的参数。https://developer.wordpress.org/reference/classes/WP_Term_Query/__construct/
$term_args = array(
\'taxonomy\' => array(\'tax_one\', \'tax_two\', \'tax_six\'),
\'hide_empty\' => false,
\'fields\' => \'all\',
\'count\' => true,
);
$term_query = new WP_Term_Query($term_args);
foreach ( $term_query->terms as $term ) {
// Here is what lives inside of $term when the \'field\' parameter above is set to all
/*
WP_Term Object (
[term_id] => 11
[name] => General Topics
[slug] => general-topics
[term_group] => 0
[term_taxonomy_id] => 11
[taxonomy] => category
[description] =>
[parent] => 0
[count] => 22
[filter] => raw
)
*/
// Maybe build out your array() in here to NOT have duplicate Terms ??
}
希望有帮助!!