> ## Documentation Index
> Fetch the complete documentation index at: https://docs.maxicore.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# Development abilities: WP-CLI, cache, and rewrites

> Run WP-CLI commands, flush the object cache, clear transients, regenerate permalink rules, and manage DB query blocklist terms with Pro development abilities.

Development abilities give your AI agent low-level access to WordPress internals — WP-CLI command execution, object cache management, transient cleanup, and permalink rewrite regeneration. All development abilities require the **Pro plan** and the `manage_options` capability (administrator role). WP-CLI write commands require additional opt-in constants in `wp-config.php`.

## All development abilities

| Ability                          | Description                                                                                                                                                                         | Capability       | Plan |
| -------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------- | ---- |
| `maxi/run-wp-cli`                | **\[PRO]** Execute a WP-CLI command. Read-only commands are always permitted. Write commands require opt-in constants in `wp-config.php`. Hard-banned commands are always rejected. | `manage_options` | Pro  |
| `maxi/manage-db-query-blocklist` | **\[PRO]** Add, remove, or list terms in the DB query output blocklist. Applies when `DB_READS` is enabled. Seeded with common sensitive column names by default.                   | `manage_options` | Pro  |
| `maxi/flush-cache`               | **\[PRO]** Flush the WordPress object cache.                                                                                                                                        | `manage_options` | Pro  |
| `maxi/clear-transients`          | **\[PRO]** Delete expired transients or a specific transient by name.                                                                                                               | `manage_options` | Pro  |
| `maxi/regenerate-rewrites`       | **\[PRO]** Flush and regenerate WordPress permalink rewrite rules.                                                                                                                  | `manage_options` | Pro  |

## maxi/run-wp-cli

Execute a WP-CLI command directly from your AI agent. Shell metacharacters are rejected before execution — this ability accepts WP-CLI command text only, not shell commands.

### Read-only commands (always permitted)

Read-only commands require no configuration. You can call them immediately.

```json theme={null}
{ "command": "option get siteurl" }
```

```json theme={null}
{ "command": "post list --post_type=page --format=json" }
```

```json theme={null}
{ "command": "core version" }
```

Other read-only commands that are always available include `user list`, `wc tool list`, `wc log read`, and similar non-mutating commands.

### Write commands (opt-in via wp-config.php)

Write commands are blocked by default. To enable a group, add the corresponding constant to your `wp-config.php`. Only enable the groups your agent legitimately needs.

<Steps>
  <Step title="Choose the groups you need">
    | Constant                              | Commands enabled                                     |
    | ------------------------------------- | ---------------------------------------------------- |
    | `MAXI_AI_WP_CLI_ALLOW_CACHE_WRITES`   | Cache, transient, cron, and rewrite flush commands   |
    | `MAXI_AI_WP_CLI_ALLOW_CONTENT_WRITES` | Post, term, and menu write commands                  |
    | `MAXI_AI_WP_CLI_ALLOW_USER_WRITES`    | User creation and update commands                    |
    | `MAXI_AI_WP_CLI_ALLOW_OPTION_WRITES`  | Option add, update, and delete commands              |
    | `MAXI_AI_WP_CLI_ALLOW_DB_READS`       | `db query` (SELECT only) and `db export` for backups |
  </Step>

  <Step title="Add constants to wp-config.php">
    Add only the constants for the groups you need. For example, to allow cache writes and SELECT-only database queries:

    ```php theme={null}
    define( 'MAXI_AI_WP_CLI_ALLOW_CACHE_WRITES', true );
    define( 'MAXI_AI_WP_CLI_ALLOW_DB_READS', true );
    ```
  </Step>

  <Step title="Verify on the configuration page">
    See the full configuration reference and the complete read-only command allowlist at [WP-CLI configuration](/configuration/wp-cli).
  </Step>
</Steps>

<Warning>
  `maxi/run-wp-cli` is one of the most powerful abilities in Maxi AI Core. Enable only the write groups your agent needs, restrict the connected WordPress user to administrator capability, and review the audit log regularly. Hard-banned commands are always rejected regardless of which constants are defined.
</Warning>

## maxi/manage-db-query-blocklist

When `MAXI_AI_WP_CLI_ALLOW_DB_READS` is enabled, `db query` SELECT commands pass through a two-layer blocklist check: once against the SQL text (pre-execution) and once against the query output (post-execution). If a blocked term appears in either, the command is rejected and the event is audit-logged.

List the current blocklist terms:

```json theme={null}
{ "action": "list" }
```

Add a term to the blocklist:

```json theme={null}
{ "action": "add", "term": "credit_card" }
```

Remove a term from the blocklist:

```json theme={null}
{ "action": "remove", "term": "nickname" }
```

Common sensitive columns are blocked by default. If you clear the blocklist manually, the defaults are not re-added — your choice is respected.

<Note>
  Both rejection types (`db_query_blocklist_sql` and `db_query_blocklist_output`) are recorded in the audit log. Query them with `maxi/get-audit-events` using `{ "category": "wp_cli" }`.
</Note>

## maxi/flush-cache

Flush the WordPress object cache. Use this after bulk updates to ensure subsequent reads reflect the latest data rather than stale cached values.

```json theme={null}
{ "success": true, "data": { "flushed": true } }
```

## maxi/clear-transients

Delete all expired transients from the database, or delete a specific transient by name.

Delete all expired transients:

```json theme={null}
{ "success": true, "data": { "action": "cleared_expired", "rows_deleted": 12 } }
```

Delete specific transient with name parameter:

```json theme={null}
{ "success": true, "data": { "action": "deleted_single", "transient": "my_plugin_cache_key", "existed": true } }
```

<Tip>
  If a plugin is returning stale data and you suspect a transient is holding an outdated value, pass the transient key directly to clear it without affecting other cached data.
</Tip>

## maxi/regenerate-rewrites

Flush and regenerate WordPress permalink rewrite rules. Use this after registering new post types, changing permalink settings, or any plugin activation or deactivation that registers custom URL patterns.

```json theme={null}
{ "success": true, "data": { "flushed": true } }
```
