is_taxonomy_viewable() WordPress Function

The is_taxonomy_viewable() function is used to check if a taxonomy is viewable by the current user. This function is typically used in the administration area to determine whether a user has the correct permissions to view a taxonomy.

is_taxonomy_viewable( string|WP_Taxonomy $taxonomy ) #

Determines whether a taxonomy is considered “viewable”.


Parameters

$taxonomy

(string|WP_Taxonomy)(Required)Taxonomy name or object.


Top ↑

Return

(bool) Whether the taxonomy should be considered viewable.


Top ↑

Source

File: wp-includes/taxonomy.php

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

	return $taxonomy->publicly_queryable;
}


Top ↑

Changelog

Changelog
VersionDescription
5.1.0Introduced.

The content displayed on this page has been created in part by processing WordPress source code files which are made available under the GPLv2 (or a later version) license by theĀ Free Software Foundation. In addition to this, the content includes user-written examples and information. All material is subject to review and curation by the WPPaste.com community.

Show More
Show More