Website Building » WooCommerce » How Do I Hide Tags in WooCommerce?

How Do I Hide Tags in WooCommerce?

Last updated on January 19, 2023 @ 1:04 pm

If you are looking to hide tags in WooCommerce, there are a few different ways that you can do this. One way is to go to the Tags page in the WordPress admin area and uncheck the box next to the tag that you want to hide. This will remove the tag from all products that it is currently assigned to.

Another way to hide tags in WooCommerce is by editing the product page template. In your theme, locate the file called single-product.php and look for the line of code that displays the tags. This line will look something like this:

get_tags( ‘, ‘, ‘<span class="tagged_as">‘ . _n( ‘Tag:’, ‘Tags:’, 
$tag_count, ‘woocommerce’ ) . ‘ ‘, ‘</span>‘ ); ?>

All you need to do is remove that line of code and save the file. This will cause the tags section to disappear from the product page completely.

PRO TIP: If you are using WooCommerce to sell products on your WordPress website, you may want to know how to hide tags from certain products. This can be useful if you have products that are similar but do not want to show the same tags on both products.

If you want to take things a step further, you can also add some code to your functions.php file that will prevent tags from being displayed anywhere on your site. Just add this code:

// Remove tags from products
function my_custom_remove_tags() {
global $wp_taxonomies;

$wp_taxonomies['product_tag']->show_ui = false; 
// false - don't show UI
 
// also possible: $wp_taxonomies['product_tag']->show_in_menu = false; 
// false - don't show in menu
 
// also possible: $wp_taxonomies['product_tag']->show_in_nav_menus = false; 
// false - don't show in nav menus
 
// also possible: $wp_taxonomies['product_tag']->show_admin_column = false; 
// false - don't show in admin column
 
// also possible: $wp->unregister('product-tag'); 
// unregister completely
}
add_action( 'init', 'my-custom-remove-tags' );
?>

Once you add this code and save it, tags will be completely removed from your WooCommerce site.

Kathy McFarland

Kathy McFarland

Devops woman in trade, tech explorer and problem navigator.