1

On the single-post page within the loop I need an array of the_tags() which is a string. and get_tags() gives me all of the tags not only this posts. Is there an easy way to get this?

2
  • 1
    the function get_the_tags() does for a single post, what get_tags() does for the site. codex.wordpress.org/Function_Reference/get_the_tags - do you need an array of the tag ids, or a string with a comma-separated list of tag ids?
    – Michael
    May 17, 2011 at 19:39
  • get_the_tags() was the exact replacement I needed thanks. if you post as answer i'll accept. May 17, 2011 at 22:55

2 Answers 2

4

the function get_the_tags() does for a single post, what get_tags() does for the site.

1

you can use wp_get_object_terms() function:

$tags_objects = wp_get_object_terms( $post->ID, 'post_tag');

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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