get_route(); if (strpos($route, '/zadex/v1/') !== 0 || !is_user_logged_in()) { return $response; } $mode = Access::mode(); if ($mode === Access::NONE && preg_match(self::EDITOR_ROUTES, $route)) { return new WP_Error('zadex_no_access', __('Your role has no access to the Zadex editor.', 'zadex'), ['status' => 403]); } $method = method_exists($request, 'get_method') ? strtoupper((string) $request->get_method()) : 'GET'; if ($mode === Access::CONTENT && $method !== 'GET' && preg_match(self::CONTENT_BLOCKED, $route)) { return new WP_Error('zadex_content_only', __('Your role can only edit the content of pages: this action is not allowed.', 'zadex'), ['status' => 403]); } return $response; } }