Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

Is it possible to use get_post() to retrieve which tags were selected in the post?

I would like a way to store a single post's tags into a variable.

share|improve this question

1 Answer 1

up vote 0 down vote accepted
<?php $tags = get_the_tags($post_id); ?>

Here $post_id is the ID of the post of which you want to get tags. This is same parameter as passed to get_post(). When used inside the loop $post_id is optional & default to the current post.

share|improve this answer

Your Answer

 
discard

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.