Saltar navegación

[Resuelto] Query all custom fields' value into array

This support ticket is created hace 3 años, 7 meses. 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)

Este tema contiene 1 respuesta, tiene 2 mensajes.

Última actualización por Luo Yang hace 3 años, 7 meses.

Asistido por: Luo Yang.

Autor
Mensajes
#2226233
Screenshot 2021-11-22 at 12.51.02 AM.png

Dear Sir/Madam,

I have a custom post 'invoice' which contain several custom fields, how can I query all the custom fields' value into an array?

best regards,

Kelvin.

#2226571

Hello,

I assume you are going to get all custom field values from one post with custom PHP codes, if it is, please try WP function get_post_meta(), for example:

$meta = get_post_meta( get_the_ID() );

More help:
https://developer.wordpress.org/reference/functions/get_post_meta/
$key
(string) (Optional) The meta key to retrieve. By default, returns data for all keys.