So i have a custom post type (listings) and a custom taxonomy (listing_terms). The taxonomy has parent/child terms. Eg: Restaurant -> Cafe (where Cafe is the child of Restaurant). I want to only let my users to be able to select one child term and then have the parent term automatically selected when they're creating posts in the backend. So essentially only two terms can be selected.

Anyone ever try this?

Alternatively, I've been thinking that we could have a two-level select field possibly, where they'd have to pick the parent first from a dropdown then another dropdown would appear with the child terms of that first term.

I'm open to suggestions!! Kinda hit a wall here.

Just fyi, I'm also using ACF for custom fields if that helps anyone.

  • It's certainly not the easiest of tasks. This answer disables the user from selecting parent terms. Then there's this answer which turns the checkboxes into radio buttons so the user can only select 1 term. It's a lot of work. Honestly, I'd try using selectboxes with some JS filtering to narrow down selections then save them as terms and hide the normal taxonomy metabox.
    – Howdy_McGee
    Apr 21, 2016 at 17:42

1 Answer 1


I found an answer that works well. Using two dropdowns in a 'cascading' style, with the code in the gist below, users would pick from a list of parent terms first, then a second dropdown appears with the list of children. The key is that both the parent and the child terms are 'selected'.

Just took a bit of tweaking to get it right, but it seems to work great.

Thanks to some older code that still works from @hameedullah-khan


  • Thanks for sharing - some explanation would be great! Does that code go in functions.php ? Where does the dropdown appear?
    – Nikhil VJ
    Sep 11, 2019 at 7:27

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.