Skip Navigation

[Resolved] Filter terms in a Form taxonomy field

This thread is resolved. Here is a description of the problem and solution.

Problem: I would like to filter the terms that appear in a Form taxonomy field.

Solution: It's not currently possible to filter the term options in a standard taxonomy field in a Form. you may be able to accomplish something like this with custom code. Another option is to create multiple taxonomies to separate your terms.

0% of people find this useful.

This support ticket is created 6 years, 4 months ago. There's a good chance that you are reading advice that it now obsolete.

This is the technical support forum for Toolset - a suite of plugins for developing WordPress sites without writing PHP.

Everyone can read this forum, but only Toolset clients can post in it. Toolset support works 6 days per week, 19 hours per day.

Sun Mon Tue Wed Thu Fri Sat
8:00 – 12:00 8:00 – 12:00 8:00 – 12:00 8:00 – 12:00 8:00 – 12:00 - -
13:00 – 17:00 13:00 – 17:00 13:00 – 17:00 13:00 – 17:00 13:00 – 17:00 - -

Supporter timezone: America/New_York (GMT-04:00)

This topic contains 4 replies, has 2 voices.

Last updated by iain macgillivray 6 years, 4 months ago.

Assisted by: Christian Cox.

Author
Posts
#924047

I set up a new CPT and created a category and some child categories for it. However when I build a Cred form and add category select it shows the full list of categories for all post types. Is there any way to limit this to the categories assigned to the specific custom post type only.

thanks

#924245

If I understand you correctly, you have a hierarchical taxonomy with some terms in it. You have assigned terms from that taxonomy to multiple posts in multiple post types. In the Form field where a post's taxonomy terms are selected, you want to only show the terms that have been assigned to posts in the same post type being added or edited in the Form. Is that correct? If so, then I'm afraid that's not possible in the current system. It might be possible with some custom code, or you could consider changing this one hierarchical taxonomy into multiple hierarchical taxonomies. Let me know if I've misunderstood what you're trying to accomplish.

#924679

Hi Christian,

thanks for replying. Let me make it a bit clearer. I set up a CPT called Member Meals and added a category Meal type, with the following variants - breakfast, lunch, dinner, supper, snack. As I set these up under Categories they now show along with all the other Category types set up for Posts and Pages under Categories.

When I add a cred form input to select Meal Type I only want to see the above breakfast to snack options, but what I get is all the other categories in the checklist set also, from the other post types. I'd hope that I can set only the Meal Type related categories and not have this long list of all categories showing up in the form.

thanks.

#947817

Okay thanks, I understand a bit more. It's not possible to filter the standard category term list in a Form, but there are other approaches. It seems like a custom taxonomy would be the best approach here. Instead of adding "Meal Type" as a term in the standard Category taxonomy, create a new custom taxonomy called "Meal Types", then add your terms to this taxonomy. You can specify which post types should utilize this custom taxonomy, so the taxonomy meta box will only appear in post editor screens for those specific post types. You can also add the taxonomy as an input in your Form, where these terms will remain separated from the standard Category terms.

#951174

I had done as you suggest - i.e. set this up as a custom taxonomy, to solve the issue and get only the meal types I wanted for the select option on the cred form. It would still be very useful if standard categories could be filtered though. Thanks for your help.