get_method(); $nonce = $request->get_param('nonce'); // For methods that modify data, verify the nonce $methodsRequiringNonce = ['POST', 'PUT', 'PATCH', 'DELETE']; if (in_array($method, $methodsRequiringNonce) && ($this->verifyNonce($nonce) === false)) { return $this->sendHttpErrorResponse( 'Forbidden', null, 403 ); } return $next($request); } }