WordPress.org

Codex

Interested in functions, hooks, classes, or methods? Check out the new WordPress Code Reference!

Function Reference/is archive

Description

This Conditional Tag checks if any type of Archive page is being displayed. An Archive is a Category, Tag, Author, Date, Custom Post Type or Custom Taxonomy based pages. This is a boolean function, meaning it returns either TRUE or FALSE.

Usage

<?php is_archive(); ?>

Return Values

(boolean) 
True on success, false on failure.

Examples

<?php
if ( is_archive() ) {
    
// write your code here ...
}
?>

Notes

Custom Post Types

is_archive() does not accept any parameters. If you want to check if this is the archive of a custom post type, use is_post_type_archive( $post_type )

Change Log

Since: 1.5.0

Source File

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

Related

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