Skip Navigation

[Resolved] How to have dropdowns for custom taxonomy (custom post type category) by default

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

Problem:
How to have dropdowns for custom taxonomy (custom post type category) by default

Solution:
To display the taxonomy as drop-down select box you can use the following shortcode:

[cred_field field='category' force_type='taxonomy' output='bootstrap' display='select' single_select='true']

You can find the proposed solution in this case with the following reply:
https://toolset.com/forums/topic/how-to-have-dropdowns-for-custom-taxonomy-custom-post-type-category-by-default/#post-2364465

Relevant Documentation:

This support ticket is created 2 years, 8 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
- 10:00 – 13:00 10:00 – 13:00 10:00 – 13:00 10:00 – 13:00 10: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/Kolkata (GMT+05:30)

This topic contains 6 replies, has 2 voices.

Last updated by ralphN-2 2 years, 8 months ago.

Assisted by: Minesh.

Author
Posts
#2364345
Screenshot at May 16 11-53-44.png
Screenshot at May 16 11-52-54.png

Tell us what you are trying to do?
I want to show a dropdown for the CATEGORY taxonomy used in my custom post type. I do not want the user to be able to add any items to the category list. Instead, I want the user to choose between the available options. This should apply both in the WP backend (edit custom post) and the frontend post submission form. See two screenshots attached (backend, frontend).

How can I accomplish the above?

Thanks & best regards,
Ralph

#2364441

Minesh
Supporter

Languages: English (English )

Timezone: Asia/Kolkata (GMT+05:30)

Hello. Thank you for contacting the Toolset support.

For admin section to restrict the users to add the new tags, please check the following link:
- https://wordpress.stackexchange.com/questions/47691/plugin-to-restrict-non-admin-user-to-existing-tags

With the form to restrict the user adding new tag we can hide the Add button by adding custom CSS code.

#2364459

Hi Minesh,

Thank you for your email. Please note that this is not about Tags, but about Categories. I have six ad categories, and I do not want users to add new ones.
But my specific request is how to make this custom taxonomy a Drop-Down field. Both in the backend and front-end. This is not about hiding anything via CSS, which I also do not consider good practice by the way. This is about how to change the form element used from an input field to a dropdown field, not for the tags taxonomy, but only for the custom taxonomy "ad categories".

Looking forward to your further support here.

Thanks,
Ralph

#2364465

Minesh
Supporter

Languages: English (English )

Timezone: Asia/Kolkata (GMT+05:30)

To display the taxonomy as drop-down select box you can use the following shortcode:

[cred_field field='category' force_type='taxonomy' output='bootstrap' display='select' single_select='true']

Where:
- replace category with your taxonomy slug.

Toolset do not offer any feature to make taxonomy as dropdown select in the backend. Here is the article that may help you:
- hidden link

#2364473
Screenshot at May 16 15-03-58.png

Thank you Minesh,

I think we are getting closer. I have now added your shortcode and it looks as attached. There is still no dropdown field. Instead, there is an input field in which I can enter a category and then, if that category exists, it is shown and I can click on it and then click "Add".

Instead, I want to see a simple dropdown select field. The user will not know the available categories upfront. So I do not want the user to start typing into the blue. Also, I do not want to have an extra click wasted with the "Add" button.

Thank you for your continued help.

Best regards, Ralph

#2364495

Minesh
Supporter

Languages: English (English )

Timezone: Asia/Kolkata (GMT+05:30)

Please make sure that your custom taxonomy set as Hierarchical taxonomy from your taxonomy edit page.

Please check the following screenshot: hidden link

#2364505

My issue is resolved now. Thank you!