O
O
Oleg2018-01-31 11:16:54
WordPress
Oleg, 2018-01-31 11:16:54

How to remove Uncategorized category in WP?

After updating WooCommerce, the Uncategorized category appeared, how to remove it? It is impossible to delete it, like any other, because. there is no checkbox opposite its name in the list.
You need to delete it or at least hide it so that it is not displayed in the public part.

Answer the question

In order to leave comments, you need to log in

3 answer(s)
O
Orkhan Hasanli, 2018-02-01
@azerphoenix

Assign another category as the main default and then a checkbox will appear to remove Uncategorized. This category is displayed in the front-end only if it has a product or post, etc.

A
andrsans, 2018-03-09
@andrsans

Paste the code snippet into your theme's functions.php file:

<?php // Mind this opening php tag
/**
 * Remove Categories from WooCommerce Product Category Widget
 *
 * @author   Ren Ventura
 */
//* Used when the widget is displayed as a dropdown
add_filter( 'woocommerce_product_categories_widget_dropdown_args', 'rv_exclude_wc_widget_categories' );
//* Used when the widget is displayed as a list
add_filter( 'woocommerce_product_categories_widget_args', 'rv_exclude_wc_widget_categories' );
function rv_exclude_wc_widget_categories( $cat_args ) {
  $cat_args['exclude'] = array('55','68'); // здесь ID вашей категории
  return $cat_args;
}

S
SergeyCorpus, 2018-03-12
@SergeyCorpus

If the categories page is displayed via a shortcode, try this option [product_categories hide_empty="true"] where hide_empty="true" is responsible for hiding empty categories and if Uncategorized is empty, then it will not be displayed. If through the categories widget, then there is a checkbox - hide empty categories. I have not tested it on the latest version of woocommerce, but this option works on version 3.2.6.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question