taxonomy_exists() WordPress Function

The taxonomy_exists() function checks whether a given taxonomy exists. This function is useful for checking if a given taxonomy is registered before using it. For example, you might want to check if a taxonomy exists before using it in a custom taxonomy query.

taxonomy_exists( string $taxonomy ) #

Determines whether the taxonomy name exists.


Description

Formerly is_taxonomy(), introduced in 2.3.0.

For more information on this and similar theme functions, check out the Conditional Tags article in the Theme Developer Handbook.


Top ↑

Parameters

$taxonomy

(string)(Required)Name of taxonomy object.


Top ↑

Return

(bool) Whether the taxonomy exists.


Top ↑

Source

File: wp-includes/taxonomy.php

function taxonomy_exists( $taxonomy ) {
	global $wp_taxonomies;

	return isset( $wp_taxonomies[ $taxonomy ] );
}


Top ↑

Changelog

Changelog
VersionDescription
3.0.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