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 ) );
谢谢@Pekka웃,我更改了它,它正在工作:
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;
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.