is_taxonomy_viewable()WP 5.1.0

Determines whether a taxonomy is considered "viewable".

No Hooks.

Return

true|false. Whether the taxonomy should be considered viewable.

Usage

is_taxonomy_viewable( $taxonomy );
$taxonomy(string|WP_Taxonomy) (required)
Taxonomy name or object.

Changelog

Since 5.1.0 Introduced.

is_taxonomy_viewable() code WP 6.5.2

function is_taxonomy_viewable( $taxonomy ) {
	if ( is_scalar( $taxonomy ) ) {
		$taxonomy = get_taxonomy( $taxonomy );
		if ( ! $taxonomy ) {
			return false;
		}
	}

	return $taxonomy->publicly_queryable;
}