Reputation: 159
I used the following code to try it but it doesnt work. I need all terms of the taxnonmy which are saved for this explicit post. But I only get "array".
get_the_terms( $post->ID, 'regisseur', 'Regisseur: <span class="flight">
Additional I want to except the ID 43 and 76 – this terms shouldnt be shown in the list.
Why it doesnt work?
Upvotes: 0
Views: 566
Reputation: 956
If you need to get all the terms in a post, you should use wp_get_post_terms() instead of get_the_terms()
Try this (updated)
<?php
$terms = wp_get_post_terms($post->ID, 'regisseur');
if ($terms)
{
$output = '';
foreach ($terms as $term) {
//Here we exclude terms
if ($term->term_id == 43) continue;
if ($term->term_id == 76) continue;
$output .= '<span><a href="' . get_term_link($term->slug, 'regisseur') . '">' . $term->name . '</a></span>';
}
};
?>
Upvotes: 1