Quantcast
Channel: User janh - WordPress Development Stack Exchange
Viewing all articles
Browse latest Browse all 40

Answer by janh for curl POST work with user meta but not the custom user meta

$
0
0

You'll get the value as the first parameter, or you could get it out of $request, which is a WP_REST_Request object. Since you're using POST, the parameters out of $request->get_body_params() which will return an array. If you just need the actual meta value, you don't need to do this.

Your callback function should look something like this:

function user_meta_update_callback( $value, $user, $field_name, $request ) {    update_user_meta( $user[ 'id' ], $field_name, $value );}

Viewing all articles
Browse latest Browse all 40

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>