| | 196 | * Determine whether the current query is for the given taxonomy or a term |
| | 197 | * in that taxonomy. |
| | 198 | * |
| | 199 | * @param string $taxonomy The taxonomy name. Required. |
| | 200 | * @param int|array|string $term The term's ID, array of term IDs, or term slug. |
| | 201 | * @return bool If the given taxonomy and term or terms |
| | 202 | * query, true; otherwise, false. |
| | 203 | */ |
| | 204 | function is_tax_term($taxonomy, $term = null) { |
| | 205 | global $wp_query, $wp_taxonomies; |
| | 206 | |
| | 207 | if ( |
| | 208 | ( $wp_query->is_tax || $wp_query->is_category || $wp_query->is_tag ) && |
| | 209 | in_array($taxonomy, array_keys($wp_taxonomies)) |
| | 210 | ) { |
| | 211 | $queried_object = $wp_query->get_queried_object(); |
| | 212 | if ( isset($queried_object->taxonomy) && isset($queried_object->term_id) ) { |
| | 213 | $term_array = (array) $term; |
| | 214 | if ( |
| | 215 | $taxonomy == $queried_object->taxonomy && |
| | 216 | ( |
| | 217 | empty( $term ) || |
| | 218 | count(array_intersect( |
| | 219 | array($queried_object->term_id, $queried_object->name, $queried_object->slug), |
| | 220 | $term_array |
| | 221 | )) |
| | 222 | ) |
| | 223 | ) { |
| | 224 | return true; |
| | 225 | } |
| | 226 | } |
| | 227 | } |
| | 228 | return false; |
| | 229 | } |
| | 230 | |
| | 231 | /** |