I want to list tags of my current post

I am using below code

<?php $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>

The output is

Post_tag : 1024x768

Post_tag : pics

Post_tag : india

Post_tag : 1366x768

Post_tag : 1920x1080

Post_tag : 1920x1200

Post_tag : 2015

Post_tag : 3d

But it shows list of all tags and i want to list tags which is related with Post ID = 17

  • how to show tags where Post ID = 17 – user3762572 Aug 23 '15 at 19:07

Can't you just use this:

<?php the_tags( '<span class="tags">', ', ', '</span>' ); ?>


get_terms gives you all the tags from your site I think.

  • I already tried it but it is not showing any result, may be because i am using custom page and my post id is stored in $postid variable and wherever i need postid i am using this veriable. is there any way to use the_tags() with custom postid veriable. – user3762572 Aug 24 '15 at 5:14
  • Uff.. Don't know about that. I'm not an expert either. But in short future this will be interesting for me too. – ezkay Aug 25 '15 at 12:36

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