WordPress at Your Fingertips

taxonomy_exists() WP 1.0

Checks that the taxonomy name exists.

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.

1 time — 0.00001 sec (speed of light) | 50000 times — 0.02 sec (speed of light) | PHP 7.0.14, WP 4.7

No Hooks.

Return

true|false. Whether the taxonomy exists.

Usage

taxonomy_exists( $taxonomy );
$taxonomy(string) (required)
Name of taxonomy object.

Notes

  • Global. Array. $wp_taxonomies The registered taxonomies.

Changelog

Since 3.0.0 Introduced.

Code of taxonomy_exists() WP 5.8.1

function taxonomy_exists( $taxonomy ) {
	global $wp_taxonomies;

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

Conditional tags (all)

Any taxonomy

No comments
    Log In