1

I tried to test out WordPress REST API by deleting a user (using basic authentication just to see if everything works), but no matter how I try to pass the parameters to the destination server, I always get rest_missing_callback_param.

Here is a screenshot from POSTMAN:

Authentication is correct. Parameters set.

It happens even when I tried with PHP:

$ch = curl_init();
curl_setopt( $ch, CURLOPT_URL,"http://web.com/wp-json/wp/v2/users/3" );
curl_setopt( $ch, CURLOPT_CUSTOMREQUEST, "DELETE" );
curl_setopt( $ch, CURLOPT_HTTPHEADER, 

    array( 'Authorization: Bearer ' .$authToken )

);

curl_setopt( $ch, CURLOPT_POSTFIELDS, $http_query );
curl_setopt( $ch, CURLOPT_RETURNTRANSFER, true );
$output = curl_exec( $ch );
curl_close( $ch );

What could possibly be a problem here?

Thank you.

2

You need to deliver another argument - the reassign.

"Reassign the deleted user's posts and links to this user ID." - WP API documentation

Please try like this:

DELETE http://web.com/wp-json/wp/v2/users/3?reassign=NEW_USER_ID
  • You might also need to pass force=true, so the url would look like this: http://web.com/wp-json/wp/v2/users/<id>?reassign=<id>&force=true – Antony Fuentes Artavia Aug 6 '19 at 15:39

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.