Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Remove category and tag taxonomies. Useful if you're not using the blog functionality of WordPress, including the taxonomies. Be sure to uncomment the other line if you're using Genesis to avoid errors.
<?php
/**
*
* Remove default taxonomies
*
* @link http://w4dev.com/wp/remove-taxonomy/
*
*/
add_action( 'init', 'unregister_taxonomy');
//remove_action( 'genesis_entry_footer', 'genesis_post_meta' ); // uncomment this if you're using Genesis to avoid errors
function unregister_taxonomy(){
global $wp_taxonomies;
$taxonomies = array( 'category', 'post_tag' );
foreach( $taxonomies as $taxonomy ) {
if ( taxonomy_exists( $taxonomy) )
unset( $wp_taxonomies[$taxonomy]);
}
}
@tenebroso

This comment has been minimized.

Copy link

tenebroso commented Oct 24, 2014

I'm finding that this works better:

function unregister_taxonomy(){
    register_taxonomy('post_tag', array());
    register_taxonomy('category', array());
}
add_action('init', 'unregister_taxonomy');

With the earlier code, when including the 'category' in the array, I was losing the ability to paginate posts in WP 4.0. Specifically, previous_post_link() and next_post_link() stopped working altogether.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.