Sign up ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

I have created one post and post ID is 34 and added some Tags and Now I want to retrieve all tags with post ID.

enter image description here

Any Idea?

share|improve this question

2 Answers 2

This is how you can retrieve tags

$tax_tags = get_terms(array('post_tag'));
   foreach($tax_tags as $tag){
     <?php echo ucfirst($tag->taxonomy).' : ' ?>
         <a href="<?php echo get_term_link($tag); ?>"><?php echo $tag->name ?></a>

Customize it the way you like.

get_terms(array('post-tag')); fetches you tag related to a post.

You can put this code within or outsode the default loop.

Reference: get_terms

share|improve this answer

Put this inside your loop:

//Returns All Term Items for "my_term"
$term_list = wp_get_post_terms($post->ID, 'post_tag', array("fields" => "all"));

Slightly adapted from wp_get_post_terms

share|improve this answer
Thanks for response but I am getting this WP_Error Object ( [errors] => Array ( [invalid_taxonomy] => Array ( [0] => Invalid taxonomy ) ) [error_data] => Array ( ) ) –  Mr.Happy Feb 18 '14 at 9:41
Any Idea about this? –  Mr.Happy Feb 18 '14 at 9:42
Where do you call this? –  kraftner Feb 18 '14 at 9:52
In single.php file. –  Mr.Happy Feb 18 '14 at 9:52
You are using standard tags, not some custom taxonomy, right? I just tested the code and it works here. Check if you copied everything as I wrote it. –  kraftner Feb 18 '14 at 9:59

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.