Make WordPress Core


Ignore:
Timestamp:
12/02/2016 10:10:01 PM (8 years ago)
Author:
jeremyfelt
Message:

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.

Props jnylen0, rachelbaker.
Fixes #38962.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/rest-api/endpoints/class-wp-rest-users-controller.php

    r39426 r39438  
    702702     */
    703703    public function delete_item( $request ) {
     704        // We don't support delete requests in multisite.
     705        if ( is_multisite() ) {
     706            return new WP_Error( 'rest_cannot_delete', __( 'The user cannot be deleted.' ), array( 'status' => 501 ) );
     707        }
     708
    704709        $id       = (int) $request['id'];
    705710        $reassign = false === $request['reassign'] ? null : absint( $request['reassign'] );
Note: See TracChangeset for help on using the changeset viewer.