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
No comments yet... Be the first to leave a reply!