Skip Navigation

[Resolved] Making a taxomony mandatory and then limit the amount of terms you can select

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

Problem:

Im not sure if these are related or indeed 2 questions

1) Is it possible to make a custom taxonomy mandatory. For example I have a taxonomy called 'Genre' I want a selection to be mandatory (rather than having a default value)

2) Can I then limit the taxonomy so they are only able to select 3 options

So to create a post an author must select between 1 and 3 genres. They cannot select none or 4 options.

Solution:

Since the wordpress custom taxonomy are not mandatory in admin side, and there isn't any limitation for "must select between 1 and 3 genres", so there aren't both of built-in features within Toolset Form plugin.

Relevant Documentation:

This support ticket is created 5 years, 11 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
- 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 -
- 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 -

Supporter timezone: Asia/Hong_Kong (GMT+08:00)

Author
Posts
#1200216

Hi
Im not sure if these are related or indeed 2 questions

1) Is it possible to make a custom taxomony mandatory. For example I have a taxonomy called 'Genre' I want a selection to be mandatory (rather than having a default value)

2) Can I then limit the taxomony so they are only able to select say 3
.

So to create a post an author must select between 1 and 3 genres. They cannot select none or 4.
This would be for front end cred forms

Thanks

#1200310

Hello,

Since the wordpress custom taxonomy are not mandatory in admin side, and there isn't any limitation for "must select between 1 and 3 genres", so there aren't both of built-in features within Toolset Form plugin.

I suggest you add feature requests for them:
https://toolset.com/forums/forum/professional-support/#feature-request

As a workaround, you might consider custom codes, for example, when user submit the form, use filter hook "cred_form_validate" to trigger a PHP function:
https://toolset.com/documentation/programmer-reference/cred-api/#cred_form_validate

In this function do the custom validations as you want.

#1200375

Thanks, out of interest could this be done using a checkbox or select field- ie limit the amount that a person could select.

I know wouldnt be a taxonomy, but just wondering

#1200384

Unfortunately, there isn't such kind of feature within custom select field or checkboxes field too.

The custom select field of Types plugin is a single choice field, so you can not select 2 or 3 options with it,
and there isn't limitation option for custom checkboxes field(multiple choices), so you can choose 4 or more options too.

You might consider custom codes, you can also check it with our Toolset contractors:
https://toolset.com/contractors/

#1201873

My issue is resolved now. Thank you!