type = 'option'; $this->rest_base = 'options'; parent::__construct(); } public function register_routes() { register_rest_route( $this->namespace, '/' . $this->rest_base . '/(?P[\w\-\_]+)/?(?P[\w\-\_]+)?', array( array( 'methods' => WP_REST_Server::READABLE, 'callback' => array( $this, 'get_item' ), 'permission_callback' => array( $this, 'get_item_permissions_check' ), ), array( 'methods' => WP_REST_Server::EDITABLE, 'callback' => array( $this, 'update_item' ), 'permission_callback' => array( $this, 'update_item_permissions_check' ), ), ) ); } } }