• Hi everyone,
    I am trying to create my own dropdown field for a custom taxonomy with hierarchy so that when the parent option is selected, a second dropdown is displayed with the available options from the children. Only the child option would be saved.
    I am using WCFM, but WCFM frontend does not work with ACF logical conditions, so I have to create my own custom code.
    Since WCFM free support is not answering I have no choice but to resort here, so I would appreciate some help on how to get started.
    Thank you very much.
    Best regards

Viewing 1 replies (of 1 total)
  • Moderator bcworkz

    (@bcworkz)

    You’re describing a “cascading dropdown”. There are a number of online tutorials on how this is generically accomplished. You’ll need to incorporate all functionality into a action hook callback function. Add your callback to an appropriate action that fires on the page where you want the dropdowns to appear. Review the source code for the template of the page for possible action hooks.

    You can populate the dropdown options from the results of WP_Term_Query. Use the ‘parent’ arg to control which terms you get. Passing a 0 will return all top level terms. Passing the parent term’s ID will return immediate child terms. Use the ‘child_of’ arg instead if you want all of a term’s descendants in any generation.

Viewing 1 replies (of 1 total)
  • The topic ‘Two custom dropdown field’ is closed to new replies.