Title: is_archive
Published: April 25, 2014
Last modified: August 20, 2026

---

# is_archive(): bool

## In this article

 * [Description](https://developer.wordpress.org/reference/functions/is_archive/?output_format=md#description)
    - [See also](https://developer.wordpress.org/reference/functions/is_archive/?output_format=md#see-also)
 * [Return](https://developer.wordpress.org/reference/functions/is_archive/?output_format=md#return)
 * [More Information](https://developer.wordpress.org/reference/functions/is_archive/?output_format=md#more-information)
 * [Source](https://developer.wordpress.org/reference/functions/is_archive/?output_format=md#source)
 * [Related](https://developer.wordpress.org/reference/functions/is_archive/?output_format=md#related)
 * [Changelog](https://developer.wordpress.org/reference/functions/is_archive/?output_format=md#changelog)
 * [User Contributed Notes](https://developer.wordpress.org/reference/functions/is_archive/?output_format=md#user-contributed-notes)

[ Back to top](https://developer.wordpress.org/reference/functions/is_archive/?output_format=md#wp--skip-link--target)

Determines whether the query is for an existing archive page.

## 󠀁[Description](https://developer.wordpress.org/reference/functions/is_archive/?output_format=md#description)󠁿

Archive pages include category, tag, author, date, custom post type, and custom 
taxonomy based archives.

For more information on this and similar theme functions, check out the [ Conditional Tags](https://developer.wordpress.org/themes/basics/conditional-tags/)
article in the Theme Developer Handbook.

### 󠀁[See also](https://developer.wordpress.org/reference/functions/is_archive/?output_format=md#see-also)󠁿

 * [is_category()](https://developer.wordpress.org/reference/functions/is_category/)
 * [is_tag()](https://developer.wordpress.org/reference/functions/is_tag/)
 * [is_author()](https://developer.wordpress.org/reference/functions/is_author/)
 * [is_date()](https://developer.wordpress.org/reference/functions/is_date/)
 * [is_post_type_archive()](https://developer.wordpress.org/reference/functions/is_post_type_archive/)
 * [is_tax()](https://developer.wordpress.org/reference/functions/is_tax/)

## 󠀁[Return](https://developer.wordpress.org/reference/functions/is_archive/?output_format=md#return)󠁿

 bool Whether the query is for an existing archive page.

## 󠀁[More Information](https://developer.wordpress.org/reference/functions/is_archive/?output_format=md#more-information)󠁿

[is_archive()](https://developer.wordpress.org/reference/functions/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 )

## 󠀁[Source](https://developer.wordpress.org/reference/functions/is_archive/?output_format=md#source)󠁿

    ```php
    function is_archive() {
    	global $wp_query;

    	if ( ! isset( $wp_query ) ) {
    		_doing_it_wrong( __FUNCTION__, __( 'Conditional query tags do not work before the query is run. Before then, they always return false.' ), '3.1.0' );
    		return false;
    	}

    	return $wp_query->is_archive();
    }
    ```

[View all references](https://developer.wordpress.org/reference/files/wp-includes/query.php/)
[View on Trac](https://core.trac.wordpress.org/browser/tags/7.1/src/wp-includes/query.php#L161)
[View on GitHub](https://github.com/WordPress/wordpress-develop/blob/7.1/src/wp-includes/query.php#L161-L170)

## 󠀁[Related](https://developer.wordpress.org/reference/functions/is_archive/?output_format=md#related)󠁿

| Uses | Description | 
| [WP_Query::is_archive()](https://developer.wordpress.org/reference/classes/wp_query/is_archive/)`wp-includes/class-wp-query.php` |

Determines whether the query is for an existing archive page.

  | 
| [__()](https://developer.wordpress.org/reference/functions/__/)`wp-includes/l10n.php` |

Retrieves the translation of $text.

  | 
| [_doing_it_wrong()](https://developer.wordpress.org/reference/functions/_doing_it_wrong/)`wp-includes/functions.php` |

Marks something as being incorrectly called.

  |

[Show 1 more](https://developer.wordpress.org/reference/functions/is_archive/?output_format=md#)
[Show less](https://developer.wordpress.org/reference/functions/is_archive/?output_format=md#)

| Used by | Description | 
| [wp_get_archives()](https://developer.wordpress.org/reference/functions/wp_get_archives/)`wp-includes/general-template.php` |

Displays archive links based on type and format.

  | 
| [wp_title()](https://developer.wordpress.org/reference/functions/wp_title/)`wp-includes/general-template.php` |

Displays or retrieves page title for all areas of blog.

  | 
| [get_body_class()](https://developer.wordpress.org/reference/functions/get_body_class/)`wp-includes/post-template.php` |

Retrieves an array of the class names for the body element.

  |

## 󠀁[Changelog](https://developer.wordpress.org/reference/functions/is_archive/?output_format=md#changelog)󠁿

| Version | Description | 
| [1.5.0](https://developer.wordpress.org/reference/since/1.5.0/) | Introduced. |

## 󠀁[User Contributed Notes](https://developer.wordpress.org/reference/functions/is_archive/?output_format=md#user-contributed-notes)󠁿

 1.  [Skip to note 2 content](https://developer.wordpress.org/reference/functions/is_archive/?output_format=md#comment-content-508)
 2.   [Codex](https://profiles.wordpress.org/codex/)  [  11 years ago  ](https://developer.wordpress.org/reference/functions/is_archive/#comment-508)
 3. [You must log in to vote on the helpfulness of this note](https://login.wordpress.org?redirect_to=https%3A%2F%2Fdeveloper.wordpress.org%2Freference%2Ffunctions%2Fis_archive%2F%23comment-508)
    Vote results for this note: 0[You must log in to vote on the helpfulness of this note](https://login.wordpress.org?redirect_to=https%3A%2F%2Fdeveloper.wordpress.org%2Freference%2Ffunctions%2Fis_archive%2F%23comment-508)
 4. **Examples**
 5.     ```php
        <?php
        if(is_archive())
            // write your code here ...
        ?>
        ```
    
 6.  * “[is_archive()](https://developer.wordpress.org/reference/functions/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 )” The above comment
       isn’t very clear. Readers could interperate this that “[is_archive()](https://developer.wordpress.org/reference/functions/is_archive/)”
       does not work on custom post types. Maybe something along the lines of: “[is_archive()](https://developer.wordpress.org/reference/functions/is_archive/)
       does not accept any parameters. If you want to check if this is the archive 
       of a **specific **custom post type, use is_post_type_archive( $post_type )”
     * [Lewis Self](https://profiles.wordpress.org/selfdesigns/) [6 years ago](https://developer.wordpress.org/reference/functions/is_archive/#comment-4259)
 7.  [Log in to add feedback](https://login.wordpress.org/?redirect_to=https%3A%2F%2Fdeveloper.wordpress.org%2Freference%2Ffunctions%2Fis_archive%2F%3Freplytocom%3D508%23feedback-editor-508)

You must [log in](https://login.wordpress.org/?redirect_to=https%3A%2F%2Fdeveloper.wordpress.org%2Freference%2Ffunctions%2Fis_archive%2F)
before being able to contribute a note or feedback.