REST API: Disable `DELETE` requests for users in multisite.
In wp-admin, users are removed from individual sites rather than deleted. A user can only be deleted from the network admin. Until support for a PUT request that removes a user's site and content associations is available, DELETE requests are disabled to avoid possible issues with lost content. Merges [34938] onto 4.7 branch. Props jnylen0, rachelbaker. Fixes #38962 for 4.7. Built from https://develop.svn.wordpress.org/branches/4.7@39439 git-svn-id: http://core.svn.wordpress.org/branches/4.7@39379 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
19ba92e401
commit
4726c85ee5
|
@ -701,6 +701,11 @@ class WP_REST_Users_Controller extends WP_REST_Controller {
|
|||
* @return WP_REST_Response|WP_Error Response object on success, or WP_Error object on failure.
|
||||
*/
|
||||
public function delete_item( $request ) {
|
||||
// We don't support delete requests in multisite.
|
||||
if ( is_multisite() ) {
|
||||
return new WP_Error( 'rest_cannot_delete', __( 'The user cannot be deleted.' ), array( 'status' => 501 ) );
|
||||
}
|
||||
|
||||
$id = (int) $request['id'];
|
||||
$reassign = false === $request['reassign'] ? null : absint( $request['reassign'] );
|
||||
$force = isset( $request['force'] ) ? (bool) $request['force'] : false;
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
*
|
||||
* @global string $wp_version
|
||||
*/
|
||||
$wp_version = '4.7-RC1-39437';
|
||||
$wp_version = '4.7-RC1-39439';
|
||||
|
||||
/**
|
||||
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.
|
||||
|
|
Loading…
Reference in New Issue