0

I have many custom post type and I want two of them to be relate by tags. These tags are only useable to these two custom post type only.

like I have two custom post type

1. books
2. writer

and I want these two post type have custom tag which only usable to these two post type.

How can I do that.

I try with Custom Taxonomies but didn't success.

appreciate quick help.

1 Answer 1

1

As you have already pointed out in your question, custom taxonomies are the way to go here. For this taxonomy to behave like the build in taxonomy post_tag, you need to set the hierarchical parameter to false.

To make these taxonomy available to only your two specific post types, you need to specifiy this when registering your taxonomy.

Example

register_taxonomy( 'taxonomy_name', array( 'post_type_1', 'post_type_2' ), $args );

The codex (register_taxonomy) have a lot of good examples how to register a custom taxonomy. If you still get stuck after this, you should update your question with your code and exact details where you are stuck

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.