Languages: English • tag 日本語 (Add your language)
This Conditional Tag checks if a Tag archive page is being displayed. This is a boolean function, meaning it returns either TRUE or FALSE.
<?php is_tag( $tag ); ?>
is_tag(); // When any Tag archive page is being displayed. is_tag( '30' ); // When the archive page for Tag 30 is being displayed. is_tag( 'extreme' ); // When the archive page for tag with the Slug of 'extreme' is being displayed. is_tag( 'mild' ); // When the archive page for tag with the Name of 'mild' is being displayed. is_tag( array( 30, 'mild', 'extreme' ) ); // Returns true when the tag of posts being displayed is either term_ID 30, or slug "extreme", or name "mild". Note: the array ability was added at Version 3.7.
Using if condition:
if ( is_tag() ) { // Display list of tags } else { // Display list of categories }
is_tag() is located in wp-includes/query.php
.
Tags: get_tag(), get_tag_link(), get_tags(), get_the_tag_list(), get_the_tags(), is_tag(), the_tags(), single_tag_title(), tag_description(), wp_generate_tag_cloud(), wp_tag_cloud()