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

wp_tag_cloud() and the_taxonomies() work in a widget I built but I can not get the_tags() to work.

I want to display the tags assigned to the current post. I built a widget to do this. the widget works fine but as I mentioned, wp_tag_cloud() and the_taxonomies() will display.

I have tried every possible code snippet I could find.

Whats happening and do I display the posts tags?

share|improve this question

I could not see the forest between the trees.

I was dealing with a custom taxonomy and solved the problem with get_the_terms().

    $kw_tags = '';
    $tags    = get_the_terms( $pid, 'place_tags' );
    $xt          = 1;

    if ($tags && ! is_wp_error($tags)) {
        ?><h4><?php echo get_option('tag_cloud_title'); ?></h4><?php
        foreach ($tags as $tag) {
            $kw_tags = $tag->name;
            <span class="tag-widget"><a href="<?php ?>" title="<?php ?>"><?php echo $kw_tags; ?></a></span>
share|improve this answer

the_tags() only work within the loop;

possibly try to use wp_get_post_tags() where you can pass the post ID

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.