Skip Navigation

[Resolved] Display Text Select Field via SQL

This support ticket is created 2 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
- 9:00 – 12:00 9:00 – 12:00 9:00 – 12:00 9:00 – 12:00 9:00 – 12:00 -
- 13:00 – 18:00 13:00 – 18:00 13:00 – 18:00 14:00 – 18:00 13:00 – 18:00 -

Supporter timezone: America/Jamaica (GMT-05:00)

This topic contains 3 replies, has 2 voices.

Last updated by Shane 2 years, 4 months ago.

Assisted by: Shane.

Author
Posts
#2447539

Hi,

Looking to build a REST API outside of PHP and looking to replicate the following PHP code to get the display text for a select field.
I can see that the data is stored in wp_options

For a given postmeta value, is there a way via SQL to extract the "display text"?

Have tried to use Query Monitor but unable to find the query.

do_shortcode(
'[types field="event-type" id="' .
$id .
'" show_name="false"][/types]'
)

#2447577

Shane
Supporter

Languages: English (English )

Timezone: America/Jamaica (GMT-05:00)

Hello,

Not sure why you would want to retrieve the value from the database using an SQL query.

Is it that you want the raw value from the database without any formatting ?

Please let me know.

Thanks,
Shane

#2447749

Hi Shane,

We built WP custom REST API end points but due to various performance issues, we've decided to build an api layer talking directly to database via ExpressJS.. Mainly for performance reasons.

We are now rebuilding the apis and as a result, for some post types and fields, I want to retrieve the "display text" of a select options toolset field. I already know the value is in postmeta but I don't want the raw value, I want the display text of that select option value.

Please advise.

Cheers

#2448035

Shane
Supporter

Languages: English (English )

Timezone: America/Jamaica (GMT-05:00)

Hello,

While I can't craft the exact query for you I can at least let you know that the display name for the field is stored in the wp_options table under the name "wpcf-fields".

The information inside this record is serialized so you will need some form of custom code to pick out the exact information that you're looking for.

Thanks,
Shane