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.

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

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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