The ability to write a description for my post tags has been a feature I’ve been patiently waiting for in WordPress. As far as I know, this has always existed for categories and link categories.
What can one do with tag descriptions?
- Use them on your tag archives to display more information about that particular tag.
- Use them to add a meta description on your tag archives.
- Display a specific tag’s description anywhere on your site.
- Probably some other cool stuff I haven’t thought of yet.
I’ll be describing the first three techniques in this tutorial. And, if you’re lucky enough to be using the Hybrid theme, this will all be taken care of for you in the next update.
Adding descriptions to your tags
Before we get into using tag descriptions within our theme, we’ll want to actually write some descriptions. Head over to your Post Tags section in your WordPress admin and click on a tag to edit. You’ll be presented with the option to edit the tag name, slug, and description.
Just write something that describes what this tag means to you and your site.

Adding the tag description to your tag archives
Open your theme’s tag.php file. If your theme doesn’t have a tag.php file, it’s probably not very good and I recommend finding a new one. You might have to rig up your archive.php file if you insist on sticking with it.
There’s typically an area where the tag title is shown using the single_tag_title() function. Beneath that, add this code:
<div class="tag-description">
<?php echo tag_description(); ?>
</div>
Now, your tag descriptions will be displayed when a visitor is browsing a tag archive.
Using the tag description as your meta description
This technique will be useful for SEO plugin developers and theme developers. Here’s some simple code to add a meta description when viewing a tag archive.
<?php if ( is_tag() && tag_description() ) : ?>
<meta name="description" content="<?php echo wp_specialchars( strip_tags( tag_description() ), 1 ); ?>" />
<?php endif; ?>
Display a tag description by ID
If you need a specific tag description when not on that tag archive, you’ll need to know the tag’s ID. Once you’ve found that, it’s as simple as adding the code where you want it.
<?php echo tag_description( '100' ); ?>
Have fun with your tag descriptions
Remember, the tag_description() function is only available in WordPress 2.8+, which is currently under development and things could change. For more information on this function, check out the tag_description() page on the WordPress Codex.
I’m also thinking of doing a few other WordPress 2.8-specific tutorials in the next week or two. Several of the new features have been covered by other WordPress blogs, but if you’d like to see a tutorial on anything new written by me, feel free to ask in the comments.


Now just add the feature to make the comment-able and give them unique IDs in the same line as post and pages … and voila … you got almost got a Topic Map inside Worpdress.
http://en.wikipedia.org/wiki/Topic_Maps
It seems so simple, wonder why it wasn’t there when tags were added.
ben_ — Couldn’t you just create a topic map with your tags as it stands?
Matthew — I was thinking the same thing. The ability to do it was probably present, but the interface wasn’t. That’s my guess.
@Justin: Sure. Giving them a description is just another step of moving them from Meta-Data to Meta-Content. Making them commentable and having only one zentralised ID-System for Posts and Tags (eg. Topics) are further steps, although you don’t need them to create a topic map.
Good to know this is coming. I was just thinking that it would be nice to have around. Though I doubt I’ll be disciplined enough to give descriptions to all my tags.
david — That’s the part I dread — going back in and writing all of the tag descriptions. It would’ve been easier if this was available from the start. I would’ve just written the description whenever I created the tag.
Simple. Good to know. Thanks.
I’m just updating my theme in preparation for 2.8, and I’m wondering if there’s a way of adding links and images to tag descriptions (and category descriptions)?
Mary-Ann Horley — Some HTML is allowed, but to allow full HTML, you’ll need to add this to your theme’s
functions.phpfile:I too wanted this feature, I am now looking forward to write excellent descriptions for my tags.
Thanks very much Justin!
[...] 4. Tag descriptions in WordPress 2.8 [...]
sorry..a bit out of topic but could you please let me know how you make that questioned mark mouse cursor when hovered over an abbreviation word ?
Best~
[...] Get more details here on how to use Tag descriptions in WordPress 2.8 [...]
[...] Tag description in WordPress 2.8 —Justin Tadlock [...]
wordpress lovers — Glad I’m not the only one.
Mary-Ann Horley — You’re welcome. I hope you put it to good use.
eddai — Sure thing:
[...] Tag Descriptions in Wordpress 2.8 [...]
Great explanation of tag description! wpSEO http://wpseo.org has already implemented this feature in their plugin to improve SEO on your WordPress installation.
Not A Niche — Cool. Glad to see others taking notice of this and implementing it.
There’s also the
term_description()function for custom taxonomies.[...] The New Widget API is a very good tutorial if you plan to create a widget for your new WordPress. * Tag descriptions in WordPress 2.8 will teach you how to add descriptions to your tags and answer the question why you should add them [...]
Thanks! I use tag description in some other way. It’s a good possibility to place affilate link here
[...] 33.Tag descriptions in WordPress 2.8 [...]
[...] 33.Tag descriptions in WordPress 2.8 [...]
Thanks for the meta description explanation! I had no idea how to do that and found you on a Google search. You’re the man!
Thanks for the post, Justin. I noticed that when entering descriptions in admin, you can’t put in an image (img src…) link. Wordpress appears to strip them immediately, independently of the theme (so the solution you mentioned, involving the themes functions.php file, doesn’t work.)
Any thoughts on allow some limited HTML, such as a, img, blockquote etc.?
Thanks!
Thanks very much Justin, very useful information .
ist must use quote in description tag ?
remove_filter( 'term_description', 'wp_kses_data' );is needed to allow full html in tag descriptions in 2.9I wonder if there is a way to automate the tag description using boilerplate text and hooks to the tag name.
i.e. This is a list of all the posts for %tag%. We love %tag%. We dream of %tag%.
not sure if this would count towards duplicate content issues or not – doubt it if the text is short…
Ben
This is awesome. Thank you so much for it. I really want to get images showing up, but something isn’t working right. I added the code you mentioned to functions.php, and the images show up inside WP when I edit the tag, but they don’t show up on the page. Any idea why?
Hi,
remove_filter( ‘term_description’, ‘wp_kses_data’ )
is working well for strong or italic, but I like to use in the description. Do you see any way to manage this?
Ralf
Hi,
I use tag descriptions on my site to great effect. The one problem i do have, however, is that it seems to strip some of the html tags.
If the text is more than one paragraph it strips all the tags except for the first and last, and replaces them with instead.
Do you know any way around this?
Thanks!
I have been building out my tag.php in my template to offer as much relevant content as possible when an incoming reader lands on this page. Something I wanted to do was provide a picture as well as brief writeup about the topic of the tag.
I hacked the functions.php so that I could input images, links, paragraphs, and other HTML into this field, but when I call it via , all i get is just the stripped down text.
I have added the
remove_filter( 'term_description', 'wp_kses_data' );, but no dice.You can use full HTML in your tag descriptions by adding the following to functions.php
It worked for me!