Skip to content

Instantly share code, notes, and snippets.

Last active Aug 29, 2015
What would you like to do?
I don't really like categories. I prefer tags. Let's hide what's not going to be used.
namespace ChangeMe\Theme\Modules;
class Core {
public function __construct() {
add_action('admin_init', array($this, 'disable_category_feature'));
add_filter('rewrite_rules_array', array($this, 'remove_category_rewrites'));
public function disable_category_feature() {
unregister_widget('WP_Widget_Categories'); // Remove widget.
register_taxonomy('category', array()); // Unhook all the category "functionality" but leave the data.
remove_submenu_page('edit.php', 'edit-tags.php?taxonomy=category'); // Hide Administration menu.
// Permalinks for categories can go.
public function remove_category_rewrites($rules) {
foreach($rules as $rule => $rewrite) {
if(preg_match('/^category/', $rule)) {
return $rules;
$theme = new \ChangeMe\Theme\Modules\Core();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment