Skip Navigation

[Resolved] Get Custom Field description in PHP

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

Problem:
Is there a clean way to get the description of a custom field? outside of accessing the db directly i mean.

I need this to build a css table, for the lefthand labels.
see screenshot:
https://d7j863fr5jhrr.cloudfront.net/wp-content/uploads/2017/12/597483-custom_field_desc.png?x50996

Solution:
Yes, you are right, the custom field settings is stored in the table wp_options, field slug is "wpcf-fields", you can get it the field description using the PHP codes you mentioned above:

$fields=get_option( "wpcf-fields" );
$description=$fields['produkt-titel-tabelle']['description'];

Relevant Documentation:

This support ticket is created 7 years 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)

This topic contains 3 replies, has 2 voices.

Last updated by beatR 7 years ago.

Assisted by: Luo Yang.

Author
Posts
#597483
custom_field_desc.png

Hi

is there a clean way to get the description of a custom field? outside of accessing the db directly i mean.

i need this to build a css table, for the lefthand labels.

thanks!

#597497

i asked something similar a while ago but couldnt find the answer anymore 🙂

i think, currently, the only method is this
$fields=get_option( "wpcf-fields" );

and the lookup the desired information?
$description=$fields['produkt-titel-tabelle']['description'];

#597572

Dear Beat,

Yes, you are right, the custom field settings is stored in the table wp_options, field slug is "wpcf-fields", you can get it the field description using the PHP codes you mentioned above:

$fields=get_option( "wpcf-fields" );
$description=$fields['produkt-titel-tabelle']['description'];
#598721

all fine!