它没有将其包装在您可以使用的函数中,但以下操作将起作用:
$taxonomy = \'my-taxonomy\';
$taxonomy_object = get_taxonomy( $taxonomy );
$object_type = get_post_type($post_id);
if ( $terms = get_the_terms( $post_id, $taxonomy ) ) {
$out = array();
foreach ( $terms as $t ) {
$posts_in_term_qv = array();
$posts_in_term_qv[\'post_type\'] = $object_type;
if ( $taxonomy_object->query_var ) {
$posts_in_term_qv[ $taxonomy_object->query_var ] = $t->slug;
} else {
$posts_in_term_qv[\'taxonomy\'] = $taxonomy;
$posts_in_term_qv[\'term\'] = $t->slug;
}
$out[] = sprintf( \'<a href="%s">%s</a>\',
esc_url( add_query_arg( $posts_in_term_qv, \'edit.php\' ) ),
esc_html( sanitize_term_field( \'name\', $t->name, $t->term_id, $taxonomy, \'display\' ) )
);
}
/* translators: used between list items, there is a space after the comma */
echo join( __( \', \' ), $out );
};