Update endpoint
-
Hello
I try to create an endpoint to update usermeta but when I use a POST or PUT method I have an Error 404 “rest no route”. But when I use a GET method it’s return my “OK”I don’t understand why my PUT method don’t works.
add_action( 'rest_api_init', function () { register_rest_route( 'wp/v2', '/usersubscriptions/(?P<id>\d+)', array( 'methods' => 'PUT', 'callback' => 'update_subscriptions', ) ); } ); function update_subscriptions($update){ update_user_meta( $data['id'], "last_name", $update); return 'OK'; }
- The topic ‘Update endpoint’ is closed to new replies.