Skip Navigation

[Resolved] Populating a select field with values from a CPT

This support ticket is created 5 years, 1 month 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 2 replies, has 2 voices.

Last updated by peterS-14 5 years, 1 month ago.

Assisted by: Christian Cox.

Author
Posts
#1360791

Hi Toolset Support Team

When adding a select field I can manually add the options. But how could I use values from a CPT?
I searched through the support forum and in the documentation, but didn't come across any solutions yet.

Example:

I have a CPT to list countries and would like this country list to be used to populate a select field?

Is this possible?

#1360945

Hi, if you're talking about a select field in Forms, then you can use a generic field and populate the options using a View. If you're talking about a select field in the wp-admin post editor, then there's no good solution for that problem. There are some other tickets in the forum that mention a filter wpt_field_options, but I don't recommend using it as it's not documented or supported any longer. When you use this filter to set the options in a field, that field cannot be used effectively in other parts of the site, like custom search filters. At this time there is no good solution for that issue or any others caused by using wpt_field_options. If you'd like to see that added, please do submit your request in our suggestion form here: https://toolset.com/home/contact-us/suggest-a-new-feature-for-toolset/

One workaround is to create one or two options in the field manually, then export your Types settings from Toolset > Export. An XML document will be generated that includes the options you already added. With a bit of XML manipulation, you could add in the other options you want to include and re-import the field information. The new options will then be available.

#1360949

My issue is resolved now. Thank you!