I have a custom taxonomy A with some terms (A1, A2,A3, etc) and a second custom taxonomy B. I want to create a custom field in taxnomony B which will be a dropdown menu with the terms from taxonomy A. I am able to create custom fields with texts and to get the terms from taxonomy A with get_terms(). The get_terms() function, returns an array of object (every object is a term). I am not sure how to build the dropdwon. How can I connect them? (I want to do it programmatically so that I can use the code for more than one sites) Thank you

2 Answers 2


You can use ACF (Advanced Custom Fields) plugin to do this. Select Taxonomy field and set the field group to appear where you need to.

I'm pretty sure the free version of the plugin has this field.

enter image description here

  • I would prefer to do it programmatically so it would be easy to transfer the code from one site to another and just change the names of the variables. Nov 22, 2020 at 8:34

Instead of showing custom field with text, create a custom field with select dropdown.

  1. Populate that dropdown options with get_terms function (term_id as value)

  2. Add multiple attribute to select if you need to store more than one term relation.

  3. Store values as array of term ids

  4. On frontend loop trough saved array and use get_term function to get term object data.

p.s. on 4) you should check if saved term id exists, if not then you should take care of it (delete the relation or ignore on loop I guess)

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.