Using post_tag taxonomy when creating a Custom Post Type (6 posts)

  1. Albert Banks
    Posted 5 years ago #

    I'm creating a custom post type called Product and want it to use the same tags (post_tag) as Posts. I've gotten the post_tag taxonomy added to Product, but when viewing the tag in WordPress only the Posts that have the tag show up, not the Products.

    Any thoughts?

  2. chrisbrocklesby
    Posted 4 years ago #

    Same Question here... Any Ideas ?

  3. chrisbrocklesby
    Posted 4 years ago #

    Bingo !

    add_action('init', 'add_taxonomy_objects');

    function add_taxonomy_objects() {
    register_taxonomy_for_object_type('category', 'product');
    register_taxonomy_for_object_type('post_tag', 'product');

  4. StevieG
    Posted 4 years ago #

    @chrisbrocklesby I'm having the same problem. Your solution just adds the meta-box to the custom post. i think what Albert (and certainly I) mean is that once a tag is assigned to the new custom post it doesn't show up under the mormal tag archive.

  5. cerupcat
    Posted 4 years ago #

    Were you ever able to fix this? I have the same issue. Tagging works, but custom types don't show on the archive.

  6. ccloskey
    Posted 4 years ago #

    I had this problem as well. The solution for me was to use get_the_terms() rather than get_the_tags(). In get_the_terms you can specify which taxonomy to get -- get_the_tags only checks for post_tag.


Topic Closed

This topic has been closed to new replies.

About this Topic