0

I noticed the click tags panel wont appear with custom post types. I have a post type called portfolio and I would like to have the click tags panel.

Thank you.

1

1 Answer 1

0

You have to register the post_tag taxonomy for your post type:

<?php
register_taxonomy_for_object_type( 'post_tag', 'portfolio'  );

Now you've got post_tag taxonomy shared with regular posts and other post types for which tags where registered.

If you want to use custom taxonomy for example, portfolio-tag, which belongs to the portfolio custom post type only:

<?php
function portfolio_tags()
{

    $labels = array(
        'name' => 'Portfolio Tag',
        // More labels goes here
    );

    $args = array(
        'labels' => $labels,
        // More arguments goes here
    );

    // agrs: taxonomy key, custom post type, arguments
    register_taxonomy( 'portfolio-tags', 'portfolio', $args );

}

add_action( 'init', 'portfolio_tags', 0 );

For register_taxonomy() arguments see the Code Reference.

1
  • Thank you but I already did that. I can add tags for that taxonomy its just that I dont get the click tags panel that appears on other post types so instead I have to type them one by one in the tags box.
    – Cain Nuke
    Jul 22, 2018 at 20:20

Your Answer

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

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