is_taxonomy_viewable( string|WP_Taxonomy $taxonomy ): bool

In this article

Determines whether a taxonomy is considered “viewable”.

Parameters

$taxonomystring|WP_Taxonomyrequired
Taxonomy name or object.

Return

bool Whether the taxonomy should be considered viewable.

Source

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

	return $taxonomy->publicly_queryable;
}

Changelog

VersionDescription
5.1.0Introduced.

User Contributed Notes

You must log in before being able to contribute a note or feedback.