get_taxonomy

Retrieves the taxonomy object of $taxonomy.

Description

(WP_Taxonomy|false) get_taxonomy( (string) $taxonomy ); 

The get_taxonomy function will first check that the parameter string given is a taxonomy object and if it is, it will return it.

Returns (WP_Taxonomy|false)

The Taxonomy Object or false if $taxonomy doesn't exist.

Parameters (1)

0. $taxonomy (string)
Name of taxonomy object to return.

Usage

  1. if ( !function_exists( 'get_taxonomy' ) ) { 
  2. require_once ABSPATH . WPINC . '/taxonomy.php'; 
  3.  
  4. // Name of taxonomy object to return. 
  5. $taxonomy = ''; 
  6.  
  7. // NOTICE! Understand what this does before running. 
  8. $result = get_taxonomy($taxonomy); 
  9.  

Defined (1)

The function is defined in the following location(s).

/wp-includes/taxonomy.php  
  1. function get_taxonomy( $taxonomy ) { 
  2. global $wp_taxonomies; 
  3.  
  4. if ( ! taxonomy_exists( $taxonomy ) ) 
  5. return false; 
  6.  
  7. return $wp_taxonomies[$taxonomy];