# wp-config constants

> The two constants PowerWP AI reads from wp-config.php: an emergency switch that turns AI access off, and a custom folder for snapshots and backups.

Two settings can only be changed by editing `wp-config.php`. They sit outside WordPress on purpose, so nobody, including an AI app, can switch them from a PowerWP AI screen. The **Settings** screen shows their state under **wp-config.php constants**, read-only.

An AI app cannot add, change or remove a `WPAI_MCP_*` constant either. The file tools refuse a change that touches one: these constants can only be edited by a person working on the files directly.

Add them to `wp-config.php` above the comment that begins `/* That's all`.

## WPAI_MCP_DISABLED

An emergency switch. When it is `true`, AI access is off, whatever the **AI access** setting says.

```
define( 'WPAI_MCP_DISABLED', true );
```

| Item | Details |
|---|---|
| Value | `true` to switch AI access off. |
| Default | Not set. |
| Effect | Every AI app with a valid key gets HTTP 503, reason `mcp_disabled`: "AI access to this site is paused by the site administrator (PowerWP AI). Try again later." The PowerWP AI screens keep working. |
| In the screen | The **AI on** switch in the header is locked, and its tooltip reads "Turned off in wp-config.php (WPAI_MCP_DISABLED)". The setting shows as set under **Settings › wp-config.php constants**. |

Use it when you cannot log in to wp-admin during an incident. Edit the file over SFTP or in your hosting panel. To switch AI access on again, delete the line or set the value to `false`.

## WPAI_MCP_STORAGE_DIR

Where PowerWP AI keeps its private files: snapshots for rollback, backups, restore uploads, transfer files, temporary files and state flags.

```
define( 'WPAI_MCP_STORAGE_DIR', '/home/example/wpai-mcp-private' );
```

| Item | Details |
|---|---|
| Value | An absolute path to a folder. |
| Default | Not set. PowerWP AI then creates `wp-content/wpai-mcp-` followed by a random string (the uploads folder is the fallback). |
| Needs | A folder that PHP can write to. PowerWP AI creates it, and the sub-folders `snapshots`, `backups`, `restores`, `transfers`, `tmp` and `flags`, if they are missing. |
| Recommended | A folder outside the web root, so the files can never be requested over the web. |

Even in the default location the folder is protected: PowerWP AI writes `.htaccess`, `web.config` and index files into it. nginx ignores `.htaccess`, so on nginx either set this constant to a folder outside the web root or add this rule to the server block and reload nginx:

```
location ~* /wp-content/wpai-mcp-[a-z0-9]+/ { deny all; }
```

**PowerWP AI › Dashboard › Environment checks** tests whether the folder can be requested from outside, with a small test file, and warns you if it can. **Settings › wp-config.php constants** shows the current storage path with a copy button.

Things to know:

- Set the constant before you start using PowerWP AI. Snapshots and backups are looked up in the current folder. If you change the path later, copy the contents of the old folder to the new one first, or older changes can no longer be rolled back and older backups are not found.
- When the plugin is deleted, PowerWP AI removes the folder it created itself. A folder you set with this constant is left in place.
- Backups and snapshots can be large. Choose a folder on a disk with room for them. By default snapshots may take up to 2,048 MB, and files over 512 MB are left out of backups.

## WordPress constants PowerWP AI works with

These are WordPress's own constants. PowerWP AI does not define them, but some tools read or change them.

- The tool `debug_mode` switches `WP_DEBUG`, `WP_DEBUG_LOG`, `WP_DEBUG_DISPLAY`, `SCRIPT_DEBUG` and `SAVEQUERIES` in `wp-config.php`. The change is syntax-checked, health-checked and recorded in the change log. Enabling it writes errors to `debug.log` with display off, and it switches itself off again after 60 minutes by default.
- The Environment checks warn when PHP errors are displayed to visitors on a production site. Set `WP_DEBUG_DISPLAY` to `false`.
- Backups and the default storage folder use `WP_CONTENT_DIR`, and the rescue loader is written to `WPMU_PLUGIN_DIR`, which is `wp-content/mu-plugins` unless you moved it.

:::cards
- [Settings screens](/docs/reference/settings/) — Every setting and where it lives.
- [AI access switch and read-only mode](/docs/safety/access-switch/) — The switch behind WPAI_MCP_DISABLED.
- [Backups and restore](/docs/safety/backups/) — What goes into the storage folder.
:::

Source: https://powerwp.ai/docs/reference/constants/
