As the title states all I'm trying to do is get the descriptions for all tags inside the loop on my INDEX.php page to show up.

I know you can use code to call specific tag descriptions but I want to avoid that if possible since I'll have hundreds of tags all of which I want to show descriptions for.

Is there a way to modify the get_tags tag in the loop to display descriptions following each tag?

1 Answer 1


Modified from the get_tags() Codex Example

$tags = get_the_tags(); // for the specific post
// $tags = get_tags(); // all tags
$html = '<div class="post_tags">';
foreach ( $tags as $tag )
    $tag_link = get_tag_link( $tag->term_id );

    $html .= "Describtion for ".ucfirst( strtolower( $tag->name ) ).": $tag->description";
    $html .= "<a href='{$tag_link}' title='{$tag->name} Tag' class='{$tag->slug}'>{$tag->name}</a>";

$html .= '</div>';
echo $html;
  • This is great man. I appreciate that you took the time to write this, thank you. I should of been a bit more specific and will be in the future. Is there a way to limit the tags to only the ones associated with each post? (Rather than displaying all of them in the database.)
    – Kapitol
    Jun 28, 2011 at 1:01
  • See updated A and save the link to the Function Reference.
    – kaiser
    Jun 28, 2011 at 1:51

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.