Home Forums General Issues Set Child Category


Set Child Category

  • Is it possible to use the category field to select the parent category and then have a field to add your own child category when submitting the forum?

    So something like this

    If a parents selected display a field to enter a new child category. but if a child category is selected dont display a field to enter anew category?
    Sadly i have no code as im unsure if this is even possible.

  • This isn’t possible with the existing conditional logic, however, it could be built using what is available.

    Instead of using a taxonomy field for the “Parent” category, or depending on the “Category” box, you can use a select field and then dynamically fill the select field with only top level terms.

    Allow your select field to have a null value and then display the text field to enter a child field if the select field value is empty.

    Then create an acf/save_post filter that adds the category and adds the term to the post:

    I’m sure there will be a lot of little things that you also need to deal with that I haven’t thought about.

    You could also include a radio button that asks “Add new sub-cagegory?” and if the user selects yes then show the “Parent” category select field and the text box for adding the sub-category.

Viewing 2 posts - 1 through 2 (of 2 total)

The topic ‘Set Child Category’ is closed to new replies.