WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] Getting Tags For A Specific Post? (3 posts)

  1. awb9h
    Member
    Posted 1 year ago #

    Hi guys,

    A quick question: is there a way to get the tag list for a particular post? In the get_the_tag_list function, I don't see a way to actually set the post to generate tags for.

    The reason I ask is I'm trying to pull the parent post tag list for use in attachment pages. So in practice:

    http://www.pbh2.com/humor/twenty-five-hilarious-reaction-gifs/attachment/hilarious-reaction-gifs-go-to-club/

    Would display the tags of:

    http://www.pbh2.com/humor/twenty-five-hilarious-reaction-gifs/

    Thanks,
    Alec

  2. alchymyth
    Forum Moderator
    Posted 1 year ago #

  3. awb9h
    Member
    Posted 1 year ago #

    Perfect, thank you so much! For those of you interested, this is what worked for me:

    <?php echo get_the_term_list($post->post_parent, 'post_tag', '<ul class="wp-tag-cloud">
    <li>', '</li>
    <li>', '</li>
    '); ?>

    [Please wrap all code in backticks]

Topic Closed

This topic has been closed to new replies.

About this Topic