Constants and configuration
3 min read
Constants the plugin defines
Defined in the main plugin file when WordPress loads it. Read them; never redefine them.
Constant | Value |
|---|---|
| The plugin version, for example |
| Absolute path of the main plugin file |
| Absolute path of the plugin folder, with a trailing slash |
| URL of the plugin folder, with a trailing slash |
|
|
if ( defined( 'WPMCF_VERSION' ) && version_compare( WPMCF_VERSION, '1.0.0', '>=' ) ) {
// safe to use the 1.0 API
}To test whether the plugin has finished booting, use the wpmcf/booted action rather than a constant.
Constants you can set in wp-config.php
Add them above the line /* That's all, stop editing! Happy publishing. */.
Constant | Plan | Type | Default | Purpose |
|---|---|---|---|---|
| Pro | int |
| Days generated pages keep serving after a paid license expires |
| Pro | string | not set | The |
| Pro | string | not set | OpenAI API key, kept out of the database |
| Pro | string | not set | Anthropic API key |
| Pro | string | not set | Google Gemini API key |
| Free | bool |
| Rethrow errors after logging them (development and tests) |
WPMCF_PSEO_GRACE_DAYS
define( 'WPMCF_PSEO_GRACE_DAYS', 30 );When a paid license (not a trial) expires, generation, sync, AI and editing stop at once, but generated pages keep being served for a grace period, then return 404 unless they were converted to posts. The period is the constant's value in days, or 14 when it is not set. The result is then passed through the wpmcf/licensing/grace_days filter (negative values count as 0). Trials never get a grace period. See Trials, renewals and expiry.
WPMCF_CLIENT_IP_HEADER
define( 'WPMCF_CLIENT_IP_HEADER', 'HTTP_CF_CONNECTING_IP' ); // Cloudflare
define( 'WPMCF_CLIENT_IP_HEADER', 'HTTP_X_FORWARDED_FOR' ); // many reverse proxiesFront-end forms rate-limit submissions per visitor IP. By default the plugin uses REMOTE_ADDR, because forwarded headers can be forged by the visitor. Behind a proxy or CDN every visitor then shares the proxy's address and one limit. Set this constant to the header your proxy overwrites on every request.
Rule | Detail |
|---|---|
Format | Must match |
Several addresses | In a comma-separated list such as |
Validation | The value must be a valid IP; otherwise |
Last word | The result passes through the |
Only set it when the proxy really replaces that header; otherwise a visitor can choose their own IP and bypass the limit.
WPMCF_AI_{PROVIDER}_KEY
define( 'WPMCF_AI_OPENAI_KEY', 'sk-...' );
define( 'WPMCF_AI_ANTHROPIC_KEY', 'sk-ant-...' );
define( 'WPMCF_AI_GEMINI_KEY', '...' );The name is WPMCF_AI_ + the provider ID in capitals + _KEY; a provider added with wpmcf/ai/providers uses the same pattern. A non-empty constant wins over a key saved on the Settings screen and is never written to the database. The screen then reports the key's source as "constant". Keys are never sent to the browser.
WPMCF_GUARD_RETHROW
define( 'WPMCF_GUARD_RETHROW', true );The plugin's fault guard catches an error raised in one of its modules, logs it (Settings › Health), tells the admin and lets the page keep rendering. With this constant set, the guard rethrows after logging, so tests and local development show the real error. Do not set it on a live site.
WordPress constants the plugin honors
Constant | Effect |
|---|---|
| Variable engine failures are written to the PHP error log ( |
| Errors caught by the fault guard are also written to the log as |
| Registers the |
| Defined by the plugin the first time a front-end page prints a |
Related
Still stuck? Contact support