# WP-CLI commands

<!-- Generated by `pnpm docs:reference`. Do not edit this file; change the code it is read from. -->

SleekRank registers these WP-CLI commands. Each is documented by the WP-CLI docblock where it is declared; `wp help <command>` prints the same text on a site.

## `wp sleek rank`

Resolves page group data and runs maintenance for SleekRank.

## `wp sleek rank cache`

Manages the data source item cache.

## `wp sleek rank cache cleanup`

Removes a bounded batch of expired inactive items from the cache table.

Rows of the caches published page groups use stay. The twicedaily
sleek_rank_cleanup_items event runs the same cleanup and also removes
rows that no page group refers to.

```bash
wp sleek rank cache cleanup [--limit=<limit>] [--format=<format>]
```

| Argument | Description |
| --- | --- |
| `[--limit=<limit>]` | Maximum rows to remove. Defaults to 500 and is capped at 1000. |
| `[--format=<format>]` | Output format. Supports table and json. |

**Examples**

```bash
wp sleek rank cache cleanup
wp sleek rank cache cleanup --limit=100 --format=json
```

## `wp sleek rank cache status`

Reports active caches and expired-row backlogs.

```bash
wp sleek rank cache status [--format=<format>]
```

| Argument | Description |
| --- | --- |
| `[--format=<format>]` | Output format. Supports table and json. |

**Examples**

```bash
wp sleek rank cache status
wp sleek rank cache status --format=json
```

## `wp sleek rank cache sync`

Refreshes all active page-group caches.

Every group is tried; a source that fails keeps its previous rows, is
reported, and makes the command exit with an error at the end.

```bash
wp sleek rank cache sync [--group=<id>] [--format=<format>]
```

| Argument | Description |
| --- | --- |
| `[--group=<id>]` | Refresh only this page group instead of every active group. |
| `[--format=<format>]` | Output format. Supports table and json. |

**Examples**

```bash
wp sleek rank cache sync
wp sleek rank cache sync --group=12
wp sleek rank cache sync --format=json
```

## `wp sleek rank flush-rewrites`

Flushes rewrite rules and clears the pending flush flag.

Page group changes set the sleek_rank_flush_rewrites option so the
next request flushes; this does it immediately.

```bash
wp sleek rank flush-rewrites
```

**Examples**

```bash
wp sleek rank flush-rewrites
```

## `wp sleek rank items`

Lists the resolved data items of a page group.

```bash
wp sleek rank items <id> [--slug=<slug>] [--format=<format>]
```

| Argument | Description |
| --- | --- |
| `<id>` | The page group id. |
| `[--slug=<slug>]` | Only show the item with this slug. |
| `[--format=<format>]` | Output format. Supports table, json and csv. Non scalar values are JSON encoded in table and csv output. |

**Examples**

```bash
wp sleek rank items 12 --format=json
```

## `wp sleek rank page-group`

Manages the page groups.

## `wp sleek rank page-group create`

Creates a page group.

```bash
wp sleek rank page-group create --name=<name> --base-page=<id> [--slug=<slug>] --url-pattern=<pattern> [--data-sources=<json>] [--mappings=<json>] [--status=<status>] [--porcelain]
```

| Argument | Description |
| --- | --- |
| `--name=<name>` | The display name. |
| `--base-page=<id>` | The id of the page whose rendered HTML is the template. |
| `[--slug=<slug>]` | The group slug. Defaults to the sanitized name. |
| `--url-pattern=<pattern>` | URL pattern with exactly one {slug} placeholder, like services/{slug}. |
| `[--data-sources=<json>]` | Data sources as a JSON array of objects, each like {"type":"json_url","config":{"url":"https://..."},"cacheDuration":3600}. |
| `[--mappings=<json>]` | Mappings as a JSON array of objects, each like {"type":"tag","target":"h1","field":"heading","mode":"replace"}. |
| `[--status=<status>]` | publish or draft. Default draft. |
| `[--porcelain]` | Output just the new page group id. |

**Examples**

```bash
wp sleek rank page-group create --name="City Pages" --base-page=42 --url-pattern="cities/{slug}"
```

## `wp sleek rank page-group delete`

Deletes a page group.

The generated pages disappear, the base page stays.

```bash
wp sleek rank page-group delete <id> [--yes]
```

| Argument | Description |
| --- | --- |
| `<id>` | The page group id. |
| `[--yes]` | Skip the confirmation prompt. |

**Examples**

```bash
wp sleek rank page-group delete 12 --yes
```

## `wp sleek rank page-group get`

Shows one page group with its full configuration.

```bash
wp sleek rank page-group get <id> [--format=<format>]
```

| Argument | Description |
| --- | --- |
| `<id>` | The page group id. |
| `[--format=<format>]` | Output format. Supports table and json. Non scalar values are JSON encoded in table output. |

**Examples**

```bash
wp sleek rank page-group get 12 --format=json
```

## `wp sleek rank page-group list`

Lists page groups.

```bash
wp sleek rank page-group list [--status=<status>] [--format=<format>]
```

| Argument | Description |
| --- | --- |
| `[--status=<status>]` | Only show groups with this status, publish or draft. |
| `[--format=<format>]` | Output format. Supports table and json. The json output carries the full configuration. |

**Examples**

```bash
wp sleek rank page-group list --status=publish
```

## `wp sleek rank page-group update`

Updates a page group.

```bash
wp sleek rank page-group update <id> [--name=<name>] [--slug=<slug>] [--url-pattern=<pattern>] [--base-page=<id>] [--data-sources=<json>] [--mappings=<json>] [--status=<status>]
```

| Argument | Description |
| --- | --- |
| `<id>` | The page group id. |
| `[--name=<name>]` | New display name. |
| `[--slug=<slug>]` | New slug. |
| `[--url-pattern=<pattern>]` | New URL pattern with exactly one {slug} placeholder. |
| `[--base-page=<id>]` | New base page id. |
| `[--data-sources=<json>]` | New data sources as a JSON array. |
| `[--mappings=<json>]` | New mappings as a JSON array. |
| `[--status=<status>]` | publish or draft. |

**Examples**

```bash
wp sleek rank page-group update 12 --status=draft
```

## `wp sleek rank reload`

Reloads the data source caches of page groups.

Fetches every data source of the page group again and replaces its
cached rows, like the Reload data button in the workspace. The first
source that fails stops the command with that source's error.

```bash
wp sleek rank reload [<id>] [--all]
```

| Argument | Description |
| --- | --- |
| `[<id>]` | The page group id. Omit it and pass --all to reload every active group. |
| `[--all]` | Reload every active page group. |

**Examples**

```bash
wp sleek rank reload 12
wp sleek rank reload --all
```

## `wp sleek rank routes`

Lists every generated public route.

```bash
wp sleek rank routes [--format=<format>]
```

| Argument | Description |
| --- | --- |
| `[--format=<format>]` | Output format. Supports json and count. Defaults to json. |

**Examples**

```bash
wp sleek rank routes
wp sleek rank routes --format=count
```

## `wp sleek rank settings`

Manages the SleekRank settings.

## `wp sleek rank settings set`

Sets the data source API credentials.

```bash
wp sleek rank settings set [--google-sheets-key=<key>] [--notion-token=<token>] [--validate]
```

| Argument | Description |
| --- | --- |
| `[--google-sheets-key=<key>]` | The Google Sheets API key, stored in the sleek_rank_google_sheets_api_key option. |
| `[--notion-token=<token>]` | The Notion integration token, stored in the sleek_rank_notion_token option. |
| `[--validate]` | Check the credentials against the provider and abort when they are rejected. |

**Examples**

```bash
wp sleek rank settings set --notion-token=secret_abc --validate
```

## `wp sleek rank sitemap`

Lists the sitemap entries generated from page groups.

```bash
wp sleek rank sitemap [--group=<id>] [--format=<format>]
```

| Argument | Description |
| --- | --- |
| `[--group=<id>]` | Only build entries for this page group. |
| `[--format=<format>]` | Output format. Supports table, json and xml. |

**Examples**

```bash
wp sleek rank sitemap --group=12 --format=xml
```
