How to Remove the ‘Uncategorized’ Category in WordPress

Remove ‘Uncategorized’ Category in WordPress

When publishing a post in WordPress we use Categories to organize our content in a related manner. This makes it easy for readers to find related content faster.

However, if you do not want to categorize a post or you forget to select the category before clicking Publish, WordPress will use the default ‘Uncategorized’ category for that post.

If you are like me, you probably get irritated every time you see ‘Uncategorized’ on a good article you are reading. It gives the impression that the publisher is careless and doesn’t put much attention while editing their posts.

So here are 3 quick ways to fix that.

 

1. Rename the Default category

To rename the ‘Uncategorized’ category, go to Posts -> Categories and click on Edit

Change the Category name and Slug accordingly then click Save.

All posts that were displaying ‘Uncategorized’ will now display the new Category name.

 

2. Change the Default Category

‘Uncategorized’ is the default category for WordPress posts, but we can change it and make another category as Default.

Decide on the new Default category you want. If you haven’t already created that category, head over to Posts -> Categories and create it.

Then go to Settings -> Writing and select the new Default category you want.

 

3. Edit the Code

If you love playing around with code, you can prevent the ‘Uncategorized’ links from displaying by editing the functions.php file.

  • Go to Appearance -> Theme Editor
  • Select the theme you are using and click on Theme Functions (functions.php)
  • Add the following code and Save the changes.

 

function remove_uncategorized_links( $categories ){

	foreach ( $categories as $cat_key => $category ){
		if( 1 == $category->term_id ){
			unset( $categories[ $cat_key ] );
		}
	}

	return $categories;
	
} add_filter('get_the_categories', 'remove_uncategorized_links', 1);

Leave a Reply

Your email address will not be published. Required fields are marked *