I created a Post Form where I collect consultation requests (custom post type). This form is placed in clinic profiles. (custom post type)
Clinics and Consultation Request post types share the same taxonomy named as Surgery.(custom taxonomy)
The form has a select field which shows ALL of the Surgery taxonomy options.
The issue is all clinics do NOT offer all the surgeries.
Would be it possible that form displays the Surgery taxonomy options depending on what clinic is being displayed. (similar to a view but within the form as SELECT field type)
Unfortunately, you're not able to make this list dynamic given that you aren't able to specify the terms that should be displayed.
Perhaps you can use some Javascript to Hide the options that you won't be using. Here is an example below of how this can be done in general. hidden link
Please let me know if this workaround was able to assist you resolving this.
Thanks,
Shane
My question is whether it is possible to display only the taxonomies that belong to the clinic (where the form is located) rather than displaying all and hiding some afterwards.
My question is whether it is possible to display only the taxonomies that belong to the clinic (where the form is located) rather than displaying all and hiding some afterwards.
If i'm understanding correctly then no it wont be possible.
Looking at how a taxonomy works you will have all the terms that are available on the form. There isn't a way to specify that x terms only belong to Y post type and W terms only belong to Z post Type when using A Taxonomy.
The terms from Taxonomy A will be available on both Y and Z post types.
"There isn't a way to specify that x terms only belong to Y post type and W terms only belong to Z post Type when using A Taxonomy."
I do NOT want to display different x terms belong to Y post TYPE.
Maybe it is better if I give an example. I have custom post type called clinic. (clinicA, clinicB, clinicC)
I have custom taxonomy called treatments. (hair transplant, liposuction, nose job)
Then there is a request consultation form. (each submission created a new request consultation entry)
In this form I have field name, phone, treatment type.
This form is located on clinic pages.
My question is if I can list the taxonomies (treatments) offered by the clinic where the form is shown.
Which is what i've been trying to explain from the beginning, that it won't be possible to filter the terms on the form to only display the ones that the current clinic has. It will pull all the terms from the taxonomy.