I'm creating different custom post types and taxonomies and I want to remove the 'Post Tags' taxonomy from the default 'Posts' post type. How do I go about doing this?
Thanks.
You can find this by visiting the Taxonomies screen and editing a taxonomy. You can not delete Tags and Categories because they are core features of WordPress. You also can not delete taxonomies from a third party plugin such as WooCommerce. For Tags and Categories, you can only click “Deactivate Taxonomy”.
' So make sure you have a custom post type created before you begin creating your taxonomies. Next, go to CPT UI » Add/Edit Taxonomies menu item in the WordPress admin area to create your first taxonomy. On this screen, you will need to do the following: Create your taxonomy slug (this will go in your URL)
I suggest you don't mess with the actual global. Its safer to simply deregister the taxonomy from the post type: register_taxonomy is used for both creation and modification.
function ev_unregister_taxonomy(){ register_taxonomy('post_tag', array()); } add_action('init', 'ev_unregister_taxonomy');
To remove the sidebar menu entry:
// Remove menu function remove_menus(){ remove_menu_page('edit-tags.php?taxonomy=post_tag'); // Post tags } add_action( 'admin_menu', 'remove_menus' );
Perhaps a more technically correct method would be to use unregister_taxonomy_for_object_type
add_action( 'init', 'unregister_tags' ); function unregister_tags() { unregister_taxonomy_for_object_type( 'post_tag', 'post' ); }
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With