Saltar navegación

[Cerrado] Information in USER API with field custom

This support ticket is created hace 4 años, 2 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
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)

Este tema contiene 15 respuestas, tiene 2 mensajes.

Última actualización por Christian Cox hace 4 años, 2 meses.

Asistido por: Christian Cox.

Autor
Mensajes
#1862673

1. There are multiple problems here:

$field_value = get_user_meta('wpcf-telefono_movil', true );

Please refer to WordPress's documentation for the get_user_meta function. The first parameter must be a User ID. You cannot omit the User ID, it is required.

Also, you should probably move this line so it is inside the telefono_movil_callback function. There, you have access to the $user parameter. Then you can determine the User ID from $user somehow. Refer to the WordPress documentation for more information about getting the User ID from the $user callback parameter.

2. There is a problem here:

return 'wpcf-telefono_movil';

If you return a string 'wpcf-telefono_movil', you will not see the field value in the REST API. You will only see the string 'wpcf-telefono_movil'. You should return the field value instead, once you fix the problems mentioned above.

El debate ‘[Cerrado] Information in USER API with field custom’ está cerrado y no admite más respuestas.