{"id":19028835,"date":"2026-09-25T00:07:34","date_gmt":"2026-09-25T00:07:34","guid":{"rendered":"https:\/\/wordpress.org\/support\/topic\/parent-child-categories-with-conditional-fields-best-practice\/"},"modified":"2026-09-25T00:07:34","modified_gmt":"2026-09-25T00:07:34","slug":"parent-child-categories-with-conditional-fields-best-practice","status":"publish","type":"topic","link":"https:\/\/wordpress.org\/support\/topic\/parent-child-categories-with-conditional-fields-best-practice\/","title":{"rendered":"Parent\/Child Categories with Conditional Fields \u2014 Best Practice?"},"content":{"rendered":"\n<p class=\"wp-block-paragraph\">I\u2019m building a local business directory with one Places CPT. I currently have about 20 main\/parent categories and roughly 200 child\/subcategories.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">I created category-specific fieldsets using Conditional Fields. For example, Food &amp; Dining has its own fieldset with restaurant-specific fields.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">The issue is that if a user selects only a child category such as Mexican or Breweries, the parent Food &amp; Dining category is not also selected, so the Food &amp; Dining conditional fieldset does not appear.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">I want the user experience to be simple: choose the specific business type, and automatically see the fields associated with its main parent category.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">What is the recommended GeoDirectory setup for this?<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Specifically:<\/p>\n\n\n\n<ol>\n<li>Is there a native setting, hook, or supported method to automatically assign\/select a parent category when a child category is selected?<\/li>\n\n\n\n<li>Can Conditional Fields detect that a selected category is a descendant of a parent category, rather than requiring every child category ID to be entered manually?<\/li>\n\n\n\n<li>Is there a supported parent-first \/ child-second category selector for the Add Listing form?<\/li>\n\n\n\n<li>If not, what is the recommended architecture for a directory with many parent and child categories that also needs category-specific conditional fields?<\/li>\n<\/ol>\n\n\n\n<p class=\"wp-block-paragraph\">I\u2019d like to avoid manually maintaining hundreds of child-category IDs in conditional rules if there is a cleaner supported approach.<\/p>\n","protected":false},"template":"","class_list":["post-19028835","topic","type-topic","status-publish","hentry","topic-tag-add-listing","topic-tag-categories","topic-tag-conditional-fields","topic-tag-custom-fields"],"jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/wordpress.org\/support\/wp-json\/wp\/v2\/topic\/19028835","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/wordpress.org\/support\/wp-json\/wp\/v2\/topic"}],"about":[{"href":"https:\/\/wordpress.org\/support\/wp-json\/wp\/v2\/types\/topic"}],"version-history":[{"count":0,"href":"https:\/\/wordpress.org\/support\/wp-json\/wp\/v2\/topic\/19028835\/revisions"}],"wp:attachment":[{"href":"https:\/\/wordpress.org\/support\/wp-json\/wp\/v2\/media?parent=19028835"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}