2

I am not very experienced developer and i have to solve one issue. My client wants to synchronize Ultimate member plugin tags (custom post type tags) with WordPress default posts tags. Actually ultimate member plugin tags and default posts tags will be same and he do not want to create these again. So he wants to use same taxonomy for both of these posts types (default and custom).
So according to my view if i will be able to use ultimate member plugin tags for default posts tags then all of my problem will be solved. So in this way default posts will ignore there own tags and instead of this will use ultimate member plugin tags as a taxonomy.
I am not sure that my idea is right or not but if someone will be able to guide me about this, i will really appreciate it.
Thank you!!

1

register_taxonomy_for_object_type() will do what you want as long as the taxonomy and object (post_type) are already registered elsewhere. Very useful when dealing with a plugin's CPTs you need to add a taxonomy to.

add_action( 'init', 'add_tag_tax_to_posts');

function add_tag_tax_to_posts(){

  register_taxonomy_for_object_type( 'SLUG_OF_PLUGIN_TAG_TAX_HERE', 'post' );

}

Or to do the reverse, and add the default tags (post_tag) to the CPTs:

register_taxonomy_for_object_type( 'post_tag', 'SLUG_OF_PLUGIN_CPT_HERE' );

| improve this answer | |
  • Thank you so much for your time and help Sir. I appreciate it. – wplearner Jun 9 '17 at 13:37

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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