Skip Navigation

[Closed] Information in USER API with field custom

This support ticket is created 4 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.

No supporters are available to work today on Toolset forum. Feel free to create tickets and we will handle it as soon as we are online. Thank you for your understanding.

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)

This topic contains 15 replies, has 2 voices.

Last updated by Christian Cox 4 years ago.

Assisted by: Christian Cox.

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

The topic ‘[Closed] Information in USER API with field custom’ is closed to new replies.