WordPress.org

Ready to get started?Download WordPress

Codex

Function Reference/is tag

Contents

Description

This Conditional Tag checks if a Tag archive page is being displayed. This is a boolean function, meaning it returns either TRUE or FALSE.

Usage

<?php is_tag$tag ); ?>

Parameters

$tag
(mixed) (optional) Tag ID, name, slug, or array of id's, names, and slugs.
Default: None

Return Values

(boolean) 
True on success, false on failure.

Examples

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, 'sharp', '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.

Notes

Change Log

  • Since: 2.3.0
  • 3.7.0: Make $tag parameter recieve tag ID, name, slug, or array of tag IDs, names, and slugs.

Source File

is_tag() is located in wp-includes/query.php.

Related

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()

See also index of Function Reference and index of Template Tags.