Sauter la navigation

[Fermé] Information in USER API with field custom

This support ticket is created Il y a 4 années et 2 mois. 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)

Ce sujet contient 15 réponses, a 2 voix.

Dernière mise à jour par Christian Cox Il y a 4 années et 2 mois.

Assisté par: Christian Cox.

Auteur
Publications
#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.

Le sujet ‘[Fermé] Information in USER API with field custom’ est fermé à de nouvelles réponses.