| 4551 | |
| 4552 | /** |
| 4553 | * Determines whether a taxonomy is considered "viewable". |
| 4554 | * |
| 4555 | * For built-in taxonomies such as categories and tags, the 'public' value will be evaluated. |
| 4556 | * For all others, the 'publicly_queryable' value will be used. |
| 4557 | * * |
| 4558 | * @param string|WP_Taxonomy $taxonomy Taxonomy name or object. |
| 4559 | * @return bool Whether the taxonomy should be considered viewable. |
| 4560 | */ |
| 4561 | function is_taxonomy_viewable( $taxonomy ) { |
| 4562 | if ( is_scalar( $taxonomy ) ) { |
| 4563 | $taxonomy = get_taxonomy( $taxonomy ); |
| 4564 | if ( ! $taxonomy ) { |
| 4565 | return false; |
| 4566 | } |
| 4567 | } |
| 4568 | |
| 4569 | if ( ! isset( $taxonomy->publicly_queryable, $taxonomy->_builtin, $taxonomy->public ) ) { |
| 4570 | return false; |
| 4571 | } |
| 4572 | |
| 4573 | return $taxonomy->publicly_queryable || ( $taxonomy->_builtin && $taxonomy->public ); |
| 4574 | } |