How to Remove Uncategorized Category In WordPress WooCommerce

Remove Uncategorized Category in WordPress WooCommerceDo you want to remove the uncategorized category in your WooCommerce store? If you are familiar with WordPress, you may have noticed the word “Uncategorized” in the category section. By default, if you have not added a category to your products, they are added to the uncategorized category.

A category refers to a taxonomy, which is used to group and select related posts together. They help the webmaster to order their content.

You should remove the uncategorized taxonomy because it makes your website have an unprofessional look. Additionally, your content will lack logical coherence.

If you remove this category, it will increase the readers’ satisfaction.

How to Remove Uncategorized Category In WordPress WooCommerce

In this post, we will share how you can remove uncategorized categories in your store. We will be using a custom code snippet to remove this category. This means that you need to have some coding skills before you proceed.

Ensure that you take a full backup of your site so that you can revert to the original version if you encounter a problem.

Let us see how you can achieve this.

Steps to Remove Uncategorized Category in WordPress

Here are the steps you need to follow:

  1. Log into your WordPress site and access the Dashboard as the admin user.
  2. From the Dashboard menu, click on Appearance Menu > Theme Editor Menu. When the Theme Editor page is opened, look for the theme functions file where we will add the function that will remove the uncategorized category.
  3. Add the following code to the php file:
[php] /** Remove categories from the shop and other pages
* in Woocommerce
*/

function njengah_hide_selected_terms( $terms, $taxonomies, $args ) {

$new_terms = array();

if ( in_array( ‘product_cat’, $taxonomies ) && !is_admin() && is_shop() ) {

foreach ( $terms as $key => $term ) {

if ( ! in_array( $term->slug, array( ‘uncategorized’ ) ) ) {

$new_terms[] = $term;

}

}

$terms = $new_terms;

}

return $terms;

}

add_filter( ‘get_terms’, ‘njengah_hide_selected_terms’, 10, 3 );
[/php]

Conclusion

By now, you should be able to remove the uncategorized category in WordPress. You can use the same method to remove any category in your store.

The solution we have shared has been tested and works well.

We hope that this tutorial helped to solve your problem.

Similar Articles

  1. How to Create WooCommerce Custom Shop Page