Constants

Last updatedView as Markdown

mantle.php defines these constants when the plugin file loads, before any class is instantiated. Three are guarded with if ( ! defined( … ) ) and can therefore be overridden from wp-config.php; the rest are unconditional.

Overridable

Reference

Overridable constants

Guarded by if ( ! defined( … ) ). Define these in wp-config.php before WordPress loads plugins.
3 fields
MANTLE_PLUGIN_DEBUG boolean
Enables plugin debug behaviour.
MANTLE_PLUGIN_DEV_MODE boolean
Enables development-mode behaviour.
MANTLE_SSO_PREFLIGHT_SALT string
Salt used when signing SSO preflight requests. The default is a literal committed to the repository, so it is identical on every site that does not override it.

Fixed

These are defined unconditionally, so a value set earlier in wp-config.php produces a PHP notice about redefinition rather than taking effect.

Reference

Fixed constants

Defined unconditionally in mantle.php.
8 fields
MANTLE_PLUGIN_VERSION string
Managed by release-please via an inline marker comment. Compared against the stored version setting to decide whether migrations run.
MANTLE_PLUGIN_NAME string
Display name.
MANTLE_PLUGIN_FILE string
Absolute path to mantle.php from __FILE__.
MANTLE_PLUGIN_PATH string
Plugin directory path from plugin_dir_path(). Trailing slash included.
MANTLE_PLUGIN_URL string
Plugin directory URL from plugin_dir_url().
MANTLE_API_URL url
Linchpin API base URL used for site reporting and connection.
MANTLE_SHOP_URI url
Licence server used for activation, deactivation, and uninstall.
MANTLE_SHOP_PRODUCT_ID number
Mantle’s product ID on the licence server.

WordPress constants Mantle sets

Reference

Core constants

Not Mantle-prefixed, but set by Mantle.
1 field
DISALLOW_FILE_EDIT boolean
Mantle forces this to true unless it is already defined, disabling the plugin and theme file editors in the admin.

Constants Mantle reads but never defines

The SSO module checks these with defined() at runtime. They exist nowhere in mantle.php, so a site that does not declare them simply takes the documented default.

Reference

SSO constants

Declare these in wp-config.php. Each one overrides the equivalent stored setting, which is what makes them usable to recover a site whose settings are wrong.
6 fields
MANTLE_SSO_DISABLE boolean
Registers none of the SSO hooks, whatever the module state says. The last resort when SSO itself is what is broken.
MANTLE_SSO_AUTO_REDIRECT boolean
Pins the automatic wp-login.php to SSO redirect on or off, overriding the sso_auto_redirect setting. Ignored when the site has no site_secret.
MANTLE_SSO_BYPASS_TOKEN string
Value the bypass query parameter must carry to reach the standard login form while the automatic redirect is on.
MANTLE_SSO_DISALLOW_ALL_DIRECT_LOGIN boolean
Rejects username and password authentication for every account and disables password resets. SSO becomes the only way in.
MANTLE_SSO_DEFAULT_ROLE string
Role given to an SSO user that org-unit mapping and the domain allowlist both decline to match.
MANTLE_SSO_GRANT_SUPER_ADMIN boolean
Multisite only. Grants super admin to newly provisioned SSO users.

Overriding constants

php wp-config.php
// Unique per site and per environment.define( 'MANTLE_SSO_PREFLIGHT_SALT', 'replace-with-a-unique-random-string' );// Optional: verbose plugin debugging on a staging site.define( 'MANTLE_PLUGIN_DEBUG', true );// Optional: keep the WordPress file editors.define( 'DISALLOW_FILE_EDIT', false );/* That's all, stop editing! Happy publishing. */require_once ABSPATH . 'wp-settings.php';
Definitions must appear above the wp-settings.php require.

Dependency loading

Two further behaviours in mantle.php are worth knowing when debugging a fatal error on boot.

  1. Composer autoloader

    If vendor/autoload.php exists it is included and the returned ClassLoader is retained.

  2. AI Client de-shadowing

    When WordPress core ships wp-includes/php-ai-client/src/AiClient.php and the plugin also has a copy, Mantle calls setPsr4( 'WordPress\\AiClient\\', [] ) to unregister its own prefix so core’s copy wins. Loading both causes class and interface conflicts.

  3. Scoped dependencies

    If third-party/vendor/autoload.php exists it is required. These are PHP-Scoper-prefixed dependencies, isolated to avoid clashing with other plugins.

  4. Boot

    mantle_init() runs on plugins_loaded, instantiates Core\Bootstrap, and calls run().

See also

Have a question about this page?

Linchpin assistant

Was this helpful?