I have a query below which I want to list ONLY those categories assigned to the current post I am viewing.
At the moment, it lists ALL of the categories for my custom post type.
Is it possible to list just those for the individual post? The post type is called ‘resource’ and the category attached to this post type is called ‘resource-category’.
<?php
$taxonomy = 'resource-category';
$tax_terms = get_terms($taxonomy);
?>
<?php
foreach ($tax_terms as $tax_term) {
echo '' . '<a href="' . esc_attr(get_term_link($tax_term, $taxonomy)) . '" title="' . sprintf( __( "View all posts in %s" ), $tax_term->name ) . '" ' . '>' . $tax_term->name.'</a> ';
}
?>
You can use
wp_get_post_terms
: