I would remove Tag capability from classic Post type, can I use remove_theme_support( $feature ); and how to do this ?

Thanks in advance

  • unregister_taxonomy('post_tag') ? – onetrickpony Apr 4 '12 at 19:41
  • @OneTrickPony Unfortunately not yet... – mor7ifer Apr 4 '12 at 19:45

You can do it with something like this:

add_action( 'init', 'wpse48017_remove_tags' );
function wpse48017_remove_tags() {
    global $wp_taxonomies;
    $tax = 'post_tag'; // this may be wrong, I never remember the names on the defaults
    if( taxonomy_exists( $tax ) )
        unset( $wp_taxonomies[$tax] );

There was a move to get a function implemented but that hasn't hit yet.

| improve this answer | |

As of WordPress 3.7, there is an unregister_taxonomy_for_object_type function available for just this sort of thing.

In your case:

// Remove tags support from posts
function myprefix_unregister_tags() {
    unregister_taxonomy_for_object_type('post_tag', 'post');
add_action('init', 'myprefix_unregister_tags');

View the documentation for this function here.

| improve this answer | |
  • 1
    +1 but maybe you should check if the post type and the taxonomy are actually registered at this hook. And if they are, you probably don't want to use the same default priority of 10 as the callback to register it has used. – kaiser Oct 8 '14 at 15:56
  • The chosen answer should be switched to this one. – lkraav Mar 8 '16 at 14:20

@m0r7if3r's answer actually produces an error in the in the 'Right Now' Dashboard widget. Even with errors turned off, the 'Tags' row is displayed with a blank count. I extended that solution to also hide 'Tags' from this Dashboard widget:

add_action( 'init', 'wpse48017_remove_tags' );
function wpse48017_remove_tags(){
    global $wp_taxonomies;
    global $pagenow;
    if( $pagenow == 'index.php' ){
        add_action( 'admin_head', 'ob_start', 0, 0 );
        add_action( 'right_now_content_table_end', 'wpse48017_remove_tags_dashboard' );
function wpse48017_remove_tags_dashboard(){
    #echo '<pre>'.htmlentities( ob_get_clean(), 0, null, true );die();
    echo preg_replace('#(Categories</a></td></tr>)<tr>([\s\S]*?number_format\(\) expects parameter 1 to be double, object given[\s\S]*?)?<td class="first b b-tags.*?</tr>#','$1',ob_get_clean());

There are probably other areas where removing tags produces errors, or breaks hardcoded links. So I thought of making this a community wiki, but that discussion probably belongs on core.trac.wordpress.org.

| improve this answer | |

You may try:

function remove_unused_taxonomies() {
        'post_tag', // or any other taxonomy name e.g. 'category'
add_action( 'init', 'remove_unused_taxonomies' );

It's not permanent, it will just hide taxonomy links in admin menu.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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