• Hello guys,

    I need some help with custom post type categories, I am struggled with this for about 2 weeks.

    I use free Viper theme which has special custom post types for products. I would like to use default post (blog) categories for this products, but I dont know how to change it. I found, that I have to add some code into functions.php:

    // add tag support to products
    function tags_support_all() {
    register_taxonomy_for_object_type(‘post_tag’, ‘products’);
    }
    // ensure all tags are included in queries
    function tags_support_query($wp_query) {
    if ($wp_query->get(‘tag’)) $wp_query->set(‘post_type’, ‘any’);
    }
    // tag hooks
    add_action(‘init’, ‘tags_support_all’);
    add_action(‘pre_get_posts’, ‘tags_support_query’);

    After I need to go to content-products.php, but I dont know what needs to be add here.

    See the screenshot: https://postimg.org/image/w6qidx0fn/
    There is default post categories, but I need it for custom post types (in my case for products). I have poor programming skills, but do you have any idea what to do? Thanks a lot.

Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
  • The topic ‘Use default post categories for custom post types’ is closed to new replies.