Some Powered Cache options can be set with constants in wp-config.php instead of the settings screen. Constants keep secrets such as API keys out of the database, survive settings imports and resets, and can differ between your staging and live site. This page lists every constant you can set.
Available in: Powered Cache (free) and Powered Cache Premium, as marked in the table
Where to find it: the wp-config.php file of your WordPress installation
Add a constant #
- Make a copy of
wp-config.php. A typing error in this file can take your site offline. - Open
wp-config.phpwith your host’s file manager, SFTP or SSH. - Add the line above /* That’s all, stop editing! Happy publishing. */, for example:
define( 'POWERED_CACHE_MISS_REASON', true ); - Save the file and reload your site.
Do not change the define( 'WP_CACHE', true ); // Powered Cache line at the top of the file. Powered Cache manages it. See Fix Configuration.
Constants #
License and credentials #
Values set as constants take priority over values saved in the settings.
| Constant | Plugin | What it does |
|---|---|---|
POWERED_CACHE_LICENSE_KEY | Premium | Your Premium license key. The license settings screen is hidden while it is defined. See License key in wp-config.php. |
POWERED_CACHE_CF_API_TOKEN | Free | Cloudflare API token. See Cloudflare Integration. |
POWERED_CACHE_CF_API_KEY | Free | Cloudflare global API key, used together with the Cloudflare Email setting. See Cloudflare Integration. |
POWERED_CACHE_SUCURI_API_KEY | Premium | Sucuri Website Firewall API key. See Sucuri Integration. |
POWERED_CACHE_SUCURI_API_SECRET | Premium | Sucuri Website Firewall API secret. See Sucuri Integration. |
define( 'POWERED_CACHE_LICENSE_KEY', 'your-license-key' );
define( 'POWERED_CACHE_CF_API_TOKEN', 'your-cloudflare-token' );
Debugging #
| Constant | Plugin | What it does |
|---|---|---|
POWERED_CACHE_MISS_REASON | Free | Set to true to add an X-Powered-Cache-Miss-Reason header to responses that were not served from the cache. See Check Cache Status. |
POWERED_CACHE_ENABLE_LOG | Free | Set to true to write the Powered Cache debug log. It also turns on the miss reason header. See Debug Log. |
POWERED_CACHE_LOG_FILE | Free | Full path of a file for the debug log. Without it, messages go to the PHP error log. |
POWERED_CACHE_LOG_IP | Free | Log only requests from this IP address, for example your own, so the log stays readable on a busy site. |
define( 'POWERED_CACHE_ENABLE_LOG', true );
define( 'POWERED_CACHE_LOG_FILE', '/home/example/logs/powered-cache.log' );
define( 'POWERED_CACHE_LOG_IP', '203.0.113.10' );
Turn logging off again when you are done. Keep the log file outside your public web folder.
Preloading and storage #
| Constant | Plugin | What it does |
|---|---|---|
POWERED_CACHE_PRELOADER_MAX_SERVER_LOAD | Free | The server load average at which preloading pauses, for example 4. Works on servers that report load averages. See Cache Preload. |
POWERED_CACHE_CACHE_DIR | Free | The folder for all cache files. Default: wp-content/cache/. The value must be a full path that ends with /. Change it only if your host requires it: the file optimizer always stores combined files in wp-content/cache/min/. After a change, run Fix configuration. |
Encryption #
| Constant | Plugin | What it does |
|---|---|---|
POWERED_CACHE_ENCRYPTION_KEY | Free | The key used to encrypt saved API keys and secrets. Default: WordPress’s LOGGED_IN_KEY. |
POWERED_CACHE_ENCRYPTION_SALT | Free | The salt used with that key. Default: WordPress’s LOGGED_IN_SALT. |
Set these when your security keys change often, for example because a security plugin rotates them. Credentials saved with the old key cannot be read anymore after the key or salt changes, so enter your Cloudflare and Sucuri credentials again afterwards.
Custom drop-ins (developers) #
| Constant | Plugin | What it does |
|---|---|---|
POWERED_CACHE_ADVANCED_CACHE_DROPIN | Free | Full path of a page cache file that advanced-cache.php loads instead of the one bundled with Powered Cache, if the file exists. |
POWERED_CACHE_OBJECT_CACHE_DROPIN | Free | Full path of an object cache file that object-cache.php loads instead of the bundled backend, if the file exists. See Object Caching. |
Use these only if you maintain your own drop-in. A custom file is not updated with Powered Cache.
Other constants Powered Cache reads #
VHP_VARNISH_IP(Premium): the Varnish server address for purge requests. It takes priority over the Varnish IP Addresses setting. See Varnish Integration.DISABLE_WP_CRON(WordPress): if you set it, make sure a server cron job callswp-cron.php, because preloading, cache cleanup and database cleanup run as background jobs. See Preload Not Running.