get_setting( 'restApiQueryHandling', 'forbidden' ); switch ( $method ) { // If we got here, the default is to return a rest_forbidden response. case 'forbidden': // Mimic a rest_forbidden response. return new \WP_Error( 'rest_forbidden', $restriction->get_setting( 'restApiQueryMessage', __( 'You do not have permission to do this.', 'content-control' ) ), [ 'status' => 403 ] ); } } return $result; } }