Thank you @Pekka 웃, I change it and it's working:
wp_get_object_terms( $post->ID, 'portfolio-skills', array( 'fields' => 'names' ) );
题
This work for me when i want to get the array that includes all the names of the taxonomy:
get_terms( 'portfolio-skills', array( 'fields' => 'names' ) );
What if i want to get the terms names associated with the current post. i tried this but it's not working:
get_terms( 'portfolio-skills', array( 'fields' => 'names' ), 'include' => array( $post->ID ) );
解决方案
Thank you @Pekka 웃, I change it and it's working:
wp_get_object_terms( $post->ID, 'portfolio-skills', array( 'fields' => 'names' ) );
其他提示
$term_list = get_the_terms($post->ID, 'your_taxonomy');
$types ='';
foreach($term_list as $term_single) {
$types .= ucfirst($term_single->slug).', ';
}
$typesz = rtrim($types, ', ');
echo $typesz;