Wordpress - Get taxonomy names by post id
Ooh, thank's for the advices and help (Robert + Peter). The Term confused myself :) This worked for me:
$taxonomies=get_taxonomies('','names');
wp_get_post_terms($post->ID, $taxonomies, array("fields" => "names"));
For any custom post type you can easily get the current post's taxonomies list. Copy and paste the following code:
<?php if(have_posts()) : the_post();
$post_type = get_post_type(get_the_ID());
$taxonomies = get_object_taxonomies($post_type);
$taxonomy_names = wp_get_object_terms(get_the_ID(), $taxonomies, array("fields" => "names"));
if(!empty($taxonomy_names)) :
foreach($taxonomy_names as $tax_name) : ?>
<p><?php echo $tax_name; ?> </p>
<?php endforeach;
endif;
endif; ?>
Try get_the_term_list
<?php echo get_the_term_list( $post->ID, 'taxonomy', '', ', ' ); ?>
You can use this in loop. Also, change taxonomy in above code with yours.