Categories are a great way to organize your posts. However, if you don’t want to categorize a post and leave the category field blank, WordPress uses default “Uncategorized” category for the post. In this post, I will show you three simple ways to prevent displaying “Uncategorized” text links on your posts or sidebar widgets.


Solution One: Prevent Displaying Uncategorized Links

Open functions.php file in your theme folder and add the following code. If you need some help editing the functions file, you can view my guide about how to edit functions.php file.

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);

This snippet will remove “Uncategorized” item from any category list or dropdown, so it won’t be displayed on your site anymore.


Solution Two: Rename Default Category (SEO Friendly)

If you don’t want to display “Uncategorized” category, you have another option. Rename it to something more meaningful! You can easily do this by visiting “Categories” page under “Posts” section on your admin panel.

To rename the category, click on “Edit” under “Uncategorized” on the categories list. First, change category name and save.

Then change category slug and click save once more. Now all your posts will display this new name instead of “Uncategorized”.


Solution Three: Change Default Category

This post was first published in 2013. But now in 2018, we have the option of changing default category for posts. To change your default category, login to your admin dashboard and go to Settings > Writing page.

On this page, you will see the option to change the Default Category for your posts. You can use that option to change default category to anything you like.


I hope you found this tip useful. Please spread the word if you want to support me. Thanks!

Deal Notice: We are using A2 hosting for all of our websites, and we are really happy with their service. So we wanted to share you this discount link for you to try it out. If you get a hosting using this link, you will also help us build better content for you: SSD Hosting - 300% Faster Than Standard Hard Drives