Question

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 ) );
Was it helpful?

Solution

Thank you @Pekka 웃, I change it and it's working:

wp_get_object_terms( $post->ID, 'portfolio-skills', array( 'fields' => 'names' ) );

OTHER TIPS

$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;
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top