> For the complete documentation index, see [llms.txt](https://docs.acpt.io/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.acpt.io/integrations/abilities-api/option-pages.md).

# Option pages

acpt/list-option-pages, acpt/get-option-page, acpt/save-option-page, acpt/delete-option-page

Category: `acpt-content-model` · Default capability: `manage_options`

| Ability                   | What it does                                                          |
| ------------------------- | --------------------------------------------------------------------- |
| `acpt/list-option-pages`  | Returns every ACPT option page                                        |
| `acpt/get-option-page`    | Returns a single option page by menu slug                             |
| `acpt/save-option-page`   | Creates an option page, or updates it if the menu slug already exists |
| `acpt/delete-option-page` | Deletes an option page                                                |

## acpt/list-option-pages

No input required.

```php
$result = wp_get_ability('acpt/list-option-pages')->execute();
```

## acpt/get-option-page

**Input**

| Property    | Type   | Required |
| ----------- | ------ | -------- |
| `menu_slug` | string | Yes      |

```php
$result = wp_get_ability('acpt/get-option-page')->execute([
    'menu_slug' => 'company-settings',
]);
```

```json
{
  "success": true,
  "message": "Operation completed successfully.",
  "data": {
    "id": "d3e4f5a6-7890-4abc-9def-0123456789ab",
    "parentId": null,
    "pageTitle": "Company Settings",
    "menuTitle": "Company",
    "capability": "manage_options",
    "menuSlug": "company-settings",
    "icon": "admin-generic",
    "description": null,
    "position": 1,
    "children": [],
    "permissions": []
  }
}
```

## acpt/save-option-page

**Input**

| Property      | Type    | Required | Notes                                                                                |
| ------------- | ------- | -------- | ------------------------------------------------------------------------------------ |
| `menu_slug`   | string  | Yes      | If a page with this menu slug already exists, it's **updated** instead of duplicated |
| `page_title`  | string  | Yes      |                                                                                      |
| `menu_title`  | string  | Yes      |                                                                                      |
| `capability`  | string  | Yes      | The WordPress capability required to see the page in wp-admin, e.g. `manage_options` |
| `position`    | integer | Yes      | Menu position                                                                        |
| `icon`        | string  | No       | Any [Dashicon](https://developer.wordpress.org/resource/dashicons/) slug             |
| `description` | string  | No       |                                                                                      |
| `parent`      | string  | No       | `menu_slug` of another option page, to make this one a submenu item under it         |
| `permissions` | array   | No       |                                                                                      |

```php
$result = wp_get_ability('acpt/save-option-page')->execute([
    'menu_slug'  => 'company-settings',
    'page_title' => 'Company Settings',
    'menu_title' => 'Company',
    'capability' => 'manage_options',
    'position'   => 1,
    'icon'       => 'admin-generic',
]);
```

## acpt/delete-option-page

**Input**

| Property         | Type    | Required | Description                                                                     |
| ---------------- | ------- | -------- | ------------------------------------------------------------------------------- |
| `menu_slug`      | string  | Yes      |                                                                                 |
| `delete_options` | boolean | No       | `true` also deletes every stored option value on that page. Defaults to `false` |

```php
$result = wp_get_ability('acpt/delete-option-page')->execute([
    'menu_slug'      => 'company-settings',
    'delete_options' => false,
]);
```
