Navigation überspringen

[Geschlossen] Information in USER API with field custom

This support ticket is created vor 4 Jahren, 2 Monaten. 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)

Dieses Thema enthält 15 Antworten, hat 2 Stimmen.

Zuletzt aktualisiert von Christian Cox vor 4 Jahren, 2 Monaten.

Assistiert von: Christian Cox.

Author
Artikel
#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.

Das Thema „[Geschlossen] Information in USER API with field custom“ ist für neue Antworten geschlossen.