我有以下代码:
$post_types = get_post_types();
if($post_types)
{
foreach($post_types as $post_type)
{
$post_type_object = get_post_type_object($post_type);
$taxonomies = get_object_taxonomies($post_type);
if($taxonomies)
{
foreach($taxonomies as $taxonomy)
{
if(!is_taxonomy_hierarchical($taxonomy)) continue;
$terms = get_terms($taxonomy, array(\'hide_empty\' => false));
if($terms)
{
foreach($terms as $term)
{
$value = $taxonomy . \':\' . $term->term_id;
if( $simple_value )
{
$value = $term->term_id;
}
$choices[$post_type_object->label . \': \' . $taxonomy][$value] = $term->name;
}
}
}
}
}
这将列出我拥有的所有分类法。但我只需要那些具有product\\u cat类别的分类法。有什么建议我该如何改变这一点?