Title: WP_Query::is_tax
Published: April 25, 2014
Last modified: May 20, 2026

---

# WP_Query::is_tax( string|string[] $taxonomy = '', int|string|int[]|string[] $term = '' ): bool

## In this article

 * [Description](https://developer.wordpress.org/reference/classes/wp_query/is_tax/?output_format=md#description)
 * [Parameters](https://developer.wordpress.org/reference/classes/wp_query/is_tax/?output_format=md#parameters)
 * [Return](https://developer.wordpress.org/reference/classes/wp_query/is_tax/?output_format=md#return)
 * [Source](https://developer.wordpress.org/reference/classes/wp_query/is_tax/?output_format=md#source)
 * [Related](https://developer.wordpress.org/reference/classes/wp_query/is_tax/?output_format=md#related)
 * [Changelog](https://developer.wordpress.org/reference/classes/wp_query/is_tax/?output_format=md#changelog)

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

Determines whether the query is for an existing custom taxonomy archive page.

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

If the $taxonomy parameter is specified, this function will additionally check if
the query is for that specific $taxonomy.

If the $term parameter is specified in addition to the $taxonomy parameter, this
function will additionally check if the query is for one of the terms specified.

## 󠀁[Parameters](https://developer.wordpress.org/reference/classes/wp_query/is_tax/?output_format=md#parameters)󠁿

 `$taxonomy`string|string[]optional

Taxonomy slug or slugs to check against.

Default:`''`

`$term`int|string|int[]|string[]optional

Term ID, name, slug, or array of such to check against.

Default:`''`

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

 bool Whether the query is for an existing custom taxonomy archive page.
 True for
custom taxonomy archive pages, false for built-in taxonomies (category and tag archives).

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

    ```php
    public function is_tax( $taxonomy = '', $term = '' ) {
    	global $wp_taxonomies;

    	if ( ! $this->is_tax ) {
    		return false;
    	}

    	if ( empty( $taxonomy ) ) {
    		return true;
    	}

    	$queried_object = $this->get_queried_object();
    	$tax_array      = array_intersect( array_keys( $wp_taxonomies ), (array) $taxonomy );
    	$term_array     = (array) $term;

    	// Check that the taxonomy matches.
    	if ( ! ( isset( $queried_object->taxonomy ) && count( $tax_array ) && in_array( $queried_object->taxonomy, $tax_array, true ) ) ) {
    		return false;
    	}

    	// Only a taxonomy provided.
    	if ( empty( $term ) ) {
    		return true;
    	}

    	return isset( $queried_object->term_id ) &&
    		count(
    			array_intersect(
    				array( $queried_object->term_id, $queried_object->name, $queried_object->slug ),
    				$term_array
    			)
    		);
    }
    ```

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

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

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

Retrieves the currently queried object.

  |

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

Determines whether the query is for an existing custom taxonomy archive page.

  |

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

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

## User Contributed Notes

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