WordPress : How To Get Tags Of A Post By Post ID

Posted by Ankur Gandhi in Common



wordpress

wp Wordpress : How To Get Tags Of A Post By Post IDHello Friends, In this post I will tell you how can we get the tags for a particlualr post by that post id. When I was making one plugin IGIT Related Posts with thumb Image After posts , I need to get the tags from a post by post id to reterive related posts by matching post tag and post title, I search about this and I found so many functions to get tags but in wordpress codex every function to get tags must be come in foreach loop, So I though to write new query to get tags list for post id, But before doing that I just tried every function by passing Post id in it to just confirm and by luck I got one function by which we can get tags for a post by post id.

get_the_tags($post->ID)

I got this function in wordpress codex but in worpress codex they said that this function must be used in foreach loop to get tags list, But as I said I have tried function by passing id to it and this function worked for me, So If you want tags for a particular post by post id then simply use get_the_tags function and pass post id as argument.

You can follow any responses to this entry through the RSS 2.0 You can leave a response, or trackback.

  • http://www.filmeshd.tv/ Download Movies Free

    Thank you for sharing this material there
    I'm always following her materials required

  • http://beerpla.net Artem Russakovskii

    I’ve amended the Codex to reflect the $id parameter.

  • Sun Szu

    this is BS – this does NOT work. It’s funny how there is a group of about 4 apparent wp devs who all seem to come out with the exact “revelation” at the same time?

  • Peter

    Thank’s, it works.