0

I now have issues with Categories and Tags after I installed WooCommerce. I had a custom Post Type for 'Products' before WooCommerce. After installation, my post type was taken over. All of my products moved into the WooCommerce 'Products' area.

The problem now is that I have two Categories and Tags sections in my admin, which is affecting user searches etc, so I need to keep using my old categories and tags instead.

enter image description here

Is there a way to hook into WP or Woocommerce to use my Old Tags and Categories globally? Or do I have to go through and change each instance of the code below:

// OLD Tags (Keep this)
wp_get_post_terms($post->ID, 'product-tags', array("fields" => "all"));

// WooCommerce Tags (Empty, Do Not Use These)
get_the_terms( $post->ID, 'product_tag' );

Here is what it looks like now in the when Editing Products:

enter image description here

3
  • Have you brought this issue up with the developers form WooCommerce? Oct 30, 2016 at 1:43
  • Not yet, but I will now...
    – Hector
    Oct 30, 2016 at 15:07
  • I got same problem. I had a look on table used by WooCommerce. WC products are saved like posts with post-type 'product', so you can't create same custom post-type (in fact : you can't use same slug as the one used by WC). Hope it will help.
    – geve2009
    Dec 7, 2017 at 14:27

1 Answer 1

0

I was able to resolve this issue by changing the rewrite slug from product-tag to product_tag when registering the taxonomy. It looks like WP does not like the hyphen and prefers the underscore.

$args = array(
        'hierarchical'          => false,
        'labels'                => $labels,
        'show_ui'               => true,
        'show_admin_column'     => true,
        'update_count_callback' => '_update_post_term_count',
        'query_var'             => true,
        'rewrite'               => array( 'slug' => 'product_tag' ),
    );

register_taxonomy( 'product-tags', 'product', $args );

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.