문제

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;
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top