Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

Here's something I can't figure out. I don't need the default post_tag taxonomy, so I'm removing it with this piece of code :

function mwm_unregister_taxonomy(){

    global $wp_taxonomies;

    $taxonomy = 'post_tag';

    if ( taxonomy_exists( $taxonomy ) ) unset( $wp_taxonomies[$taxonomy] );
}

add_action( 'init', 'mwm_unregister_taxonomy');

But then, whenever I try to add a description to a term of any other (custom) taxonomy, via the terms edit page in WP admin, once I submit the changes it brings up the blank page with the "Cheatin, uh?" message.

Is this a bug or am I doing something wrong?

share|improve this question
1  
Did small research and when you unset taxonomy $wp_taxonomies isn't object anymore, so when WordPress check capabilities while saving term description, it gets nothing and triggers wp_die –  Mamaduka Sep 21 '11 at 9:24

1 Answer 1

Try using this function to avoid your problem:

function sld_unregister_taxonomy_from_object_type($taxonomy, $object_type) { 
        global $wp_taxonomies;  
        if ( !isset($wp_taxonomies[$taxonomy]) || !get_post_type_object($object_type) ) return false; 
        foreach (array_keys($wp_taxonomies[$taxonomy]->object_type) as $array_key) { 
                if ($wp_taxonomies[$taxonomy]->object_type[$array_key] == $array_key) { 
                        unset ($wp_taxonomies[$taxonomy]->object_type[$array_key]); 
                        return true; 
                } 
        } 
        return false; 
}

e.x.:

function mwm_unregister_taxonomy(){

    sld_unregister_taxonomy_from_object_type( 'post_tag', 'post' );

}

add_action( 'init', 'mwm_unregister_taxonomy');
share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.