How can I set a relationship between two taxonomy terms (each of a different taxonomy)?

So, relate a "person" term "John Doe" with a "company" term "Acme Inc"?


Wow, it just works... I can use wp_set_object_terms() to set a term to a term...

$term_taxonomy_ids = wp_set_object_terms( $bill_term_id, $microsoft_term_id, 'company' );

And I can retrieve the company connected to a person with wp_get_object_terms like...

$bills_company_terms = wp_get_object_terms($bill_term_id, 'company');

The only thing is, how can I put a backend interface on these relationships?

  • Alas, it appears not to be bidirectional. When I wp_get_object_terms() for the company, it does not seem to contain the person which had related the company to itself. – Robert Andrews May 9 '20 at 21:21

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.