Advertisements

is_tax

Definition:
function is_tax( $taxonomy = '', $term = '' ) {}

Is the query for a taxonomy archive page?
If the $taxonomy parameter is specified, this function will additionally check if the query is for that specific $taxonomy.

Parameters

  • mixed $taxonomy: Optional. Taxonomy slug or slugs.
  • mixed $term: Optional. Term ID, name, slug or array of Term IDs, names, and slugs.

Source code

	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;



		if ( empty( $term ) ) // Only a Taxonomy provided

			return isset( $queried_object->taxonomy ) && count( $tax_array ) && in_array( $queried_object->taxonomy, $tax_array );



		return isset( $queried_object->term_id ) &&

			count( array_intersect(

				array( $queried_object->term_id, $queried_object->name, $queried_object->slug ),

				$term_array

			) );

	}

2201

Advertisements

No comments yet... Be the first to leave a reply!

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: