unregister_taxonomy_for_object_type

Remove an already registered taxonomy from an object type.

Description

unregister_taxonomy_for_object_type( (string) $taxonomy, (string) $object_type ); 

Parameters (2)

0. $taxonomy (string)
Name of taxonomy object.
1. $object_type (string)
Name of the object type.

Usage

  1. if ( !function_exists( 'unregister_taxonomy_for_object_type' ) ) { 
  2. require_once ABSPATH . WPINC . '/taxonomy.php'; 
  3.  
  4. // Name of taxonomy object. 
  5. $taxonomy = ''; 
  6.  
  7. // Name of the object type. 
  8. $object_type = ''; 
  9.  
  10. // NOTICE! Understand what this does before running. 
  11. $result = unregister_taxonomy_for_object_type($taxonomy, $object_type); 
  12.  

Defined (1)

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

/wp-includes/taxonomy.php  
  1. function unregister_taxonomy_for_object_type( $taxonomy, $object_type ) { 
  2. global $wp_taxonomies; 
  3.  
  4. if ( ! isset( $wp_taxonomies[ $taxonomy ] ) ) 
  5. return false; 
  6.  
  7. if ( ! get_post_type_object( $object_type ) ) 
  8. return false; 
  9.  
  10. $key = array_search( $object_type, $wp_taxonomies[ $taxonomy ]->object_type, true ); 
  11. if ( false === $key ) 
  12. return false; 
  13.  
  14. unset( $wp_taxonomies[ $taxonomy ]->object_type[ $key ] ); 
  15. return true;