1

I'm using WooCommerce that uses a custum post type (product) with its own product category taxonomy (product_cat). Now I'm using an other plugin (minimu) that selects posts to display based on the normal WordPress category. Seeing as my custom post types don't belong to a regular category it displays nothing... Now I want to make it so that I can assign a product category as well as a normal category to each post.

How would I have to modify this? I guess adding something to the custom post declaration of WooCommerce? But no idea how and what?

EDIT

Found this code, that makes it able to assign regular categories to custom post types but now my importer doesn't assign them, but I think I'll be able to fix this.

add_action( 'init', 'wpse6098_init', 100 ); // 100 so the post type has been registered
function wpse6098_init()
{
    register_taxonomy_for_object_type( 'category', 'product' );
}

This post may be deleted, tried to do it myself

2
  • Please always link to any used plugin, theme, repo, etc. Thanks.
    – kaiser
    Commented Sep 4, 2012 at 15:56
  • 2
    And please move your edit to an answer. This is a system that saves solutions for later users.
    – kaiser
    Commented Sep 4, 2012 at 16:08

1 Answer 1

2

Found this code, that makes it able to assign regular categories to custom types but now my importer doesnt assign them, but I think ill be able to fix this.

add_action( 'init', 'wpse6098_init', 100 ); // 100 so the post type has been registered
function wpse6098_init()
{
    register_taxonomy_for_object_type( 'category', 'product' );
}

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.