Support » Developing with WordPress » How to show name of tag+tag

Viewing 1 replies (of 1 total)
  • Moderator bcworkz


    global $wp_query;
    $tags = $wp_query->get('tag');
    echo "Posts with tags: $tags";

    $tags will be something like “books+romance”, so you might want to string replace “+” with “, ” or similar before echoing out. This outputs the tag slugs. if you want the tag names, you’ll have to get each tag’s WP_Term object in turn, from which the tag name is available.

Viewing 1 replies (of 1 total)
  • You must be logged in to reply to this topic.