I’m attempting to call a PHP function via the WordPress RestAPI and for the life of me cannot figure out how to pass a JSON variable to the following function:
function update_user_status_to_pending_from_api (WP_REST_Request $ID){
$userID = $ID->get_json_params();
wp_set_object_terms( $userID, array( 'pending' ), 'user_status', false );
clean_object_term_cache( $userID, 'user_status' );
return $ID;
return $userID;
}
I’d like to pass the ID variable via the JSON body at the time of the rest API request and the function fires when I call it via my make.com RestAPI module and I have ID in the JSON body, but the script does not consume the value. Even if I append ?ID=3 to the URL the script ignores the value.
I enabled PHP debugging both in WP and PHP which displays nothing when the function is called. When I use curl, I receive a response of 200, but I receive no $ID or $userID output as stated in the function.