Wordpress 分类法-post的显示术语

Wordpress 分类法-post的显示术语,wordpress,taxonomy,custom-taxonomy,taxonomy-terms,Wordpress,Taxonomy,Custom Taxonomy,Taxonomy Terms,我已经创建了自定义短代码来显示自定义分类法的术语 // First we create a function function list_terms_forme_juridique_taxonomy( $atts ) { // Inside the function we extract custom taxonomy parameter of our shortcode extract( shortcode_atts( array( 'custom_taxonomy' => 'fo

我已经创建了自定义短代码来显示自定义分类法的术语

// First we create a function
function list_terms_forme_juridique_taxonomy( $atts ) {

// Inside the function we extract custom taxonomy parameter of our 
shortcode

extract( shortcode_atts( array(
'custom_taxonomy' => 'forme_juridique',
 ), 
                $atts ) );

// arguments for function wp_list_categories
$args = array( 
taxonomy => $custom_taxonomy,
title_li => ''
);

// We wrap it in unordered list 
echo '<ul>'; 
echo wp_list_categories($args);
echo '</ul>';
}

// Add a shortcode that executes our function
add_shortcode( 'forme_juridique', 'list_terms_forme_juridique_taxonomy' 
);
//首先我们创建一个函数
功能列表、术语、格式、司法分类($atts){
//在函数内部,我们提取
短码
提取(短码)附件(数组)(
“自定义分类法”=>“forme_juridique”,
), 
$atts);
//函数wp_list_categories的参数
$args=数组(
分类法=>$custom\u分类法,
title_li=>“”
);
//我们把它包装在无序的列表中
回声“
    ”; echo wp_列表_类别($args); 回声“
”; } //添加一个执行函数的短代码 添加快捷代码('forme_juridique','list_terms_forme_juridique_taxonomy' );
它工作得很好,但问题是所有术语都显示出来了。我只想显示与帖子本身相对应的术语

有什么帮助吗

可能对您有用-它返回附加到帖子的自定义分类的术语(您必须具有当前帖子的ID)