WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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
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


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.