wpseek.com
Eine auf WordPress spezialiserte Suchmaschine für Entwickler und Theme-Autoren
unregister_taxonomy › WordPress Function
Seit4.5.0
Veraltetn/v
› unregister_taxonomy ( $taxonomy )
| Parameter: |
|
| Gibt zurück: |
|
| Definiert in: |
|
| Codex: |
Unregisters a taxonomy.
Can not be used to unregister built-in taxonomies.Ähnliche Funktionen: register_taxonomy, unregister_meta_key, is_taxonomy, get_taxonomy, unregister_setting
Quellcode
function unregister_taxonomy( $taxonomy ) {
global $wp_taxonomies;
if ( ! taxonomy_exists( $taxonomy ) ) {
return new WP_Error( 'invalid_taxonomy', __( 'Invalid taxonomy.' ) );
}
$taxonomy_object = get_taxonomy( $taxonomy );
// Do not allow unregistering internal taxonomies.
if ( $taxonomy_object->_builtin ) {
return new WP_Error( 'invalid_taxonomy', __( 'Unregistering a built-in taxonomy is not allowed.' ) );
}
$taxonomy_object->remove_rewrite_rules();
$taxonomy_object->remove_hooks();
// Remove the taxonomy.
unset( $wp_taxonomies[ $taxonomy ] );
/**
* Fires after a taxonomy is unregistered.
*
* @since 4.5.0
*
* @param string $taxonomy Taxonomy name.
*/
do_action( 'unregistered_taxonomy', $taxonomy );
return true;
}