Guide

Configuration

Mantle is configured in two places: PHP constants that must be defined before the plugin boots, and a settings option managed through the admin UI, the REST API, or WP-CLI.

Constants

mantle.php defines these constants at load time. Only the three guarded ones can be overridden from wp-config.php; the rest are fixed values the plugin uses internally.

Reference

Plugin constants

Defined in mantle.php. Constants marked overridable are wrapped in if ( ! defined( … ) ), so a value set earlier in wp-config.php wins.
12 fields
MANTLE_PLUGIN_DEBUG boolean
Overridable. Enables plugin debug behaviour.
MANTLE_PLUGIN_DEV_MODE boolean
Overridable. Enables development-mode behaviour.
MANTLE_SSO_PREFLIGHT_SALT string
Overridable. Salt used when signing SSO preflight requests. Change this per site.
MANTLE_PLUGIN_VERSION string
Fixed. Managed by release-please; also drives the migration check.
MANTLE_PLUGIN_FILE string
Fixed. Absolute path to mantle.php.
MANTLE_PLUGIN_PATH string
Fixed. Plugin directory path from plugin_dir_path().
MANTLE_PLUGIN_URL string
Fixed. Plugin directory URL from plugin_dir_url().
MANTLE_PLUGIN_NAME string
Fixed. Display name.
MANTLE_API_URL url
Fixed. Linchpin API base URL used for site reporting and connection.
MANTLE_SHOP_URI url
Fixed. Licence server used for activation and deactivation.
MANTLE_SHOP_PRODUCT_ID number
Fixed. Mantle’s product ID on the licence server.
DISALLOW_FILE_EDIT boolean
WordPress core constant. Mantle forces this to true unless already defined, disabling the plugin and theme file editors.

To override an overridable constant, define it in wp-config.php above the require_once ABSPATH . 'wp-settings.php'; line:

php wp-config.php
// Per-site SSO salt. Do not reuse across environments.define( 'MANTLE_SSO_PREFLIGHT_SALT', 'replace-with-a-unique-random-string' );// Keep the WordPress file editors available.define( 'DISALLOW_FILE_EDIT', false );require_once ABSPATH . 'wp-settings.php';
Constants must be defined before WordPress loads plugins.

Settings

All module settings live in a single serialised WordPress option named mantle. The schema is assembled at runtime: Mantle\Model\Settings::get_settings_schema() applies a filter that every module hooks into, so the schema always describes exactly the modules present on the site.

Flow

How a settings key comes to exist

5 relationships
Modules contribute schema keys whether or not they are enabled, so saved values are never orphaned.

Reading a setting merges saved values over schema defaults, and any saved key absent from the schema is discarded on read. That means removing a module makes its keys inert rather than corrupting the option.

For the complete list of keys, see the settings reference.

Reading and writing settings

example.php
$settings = new \Mantle\Model\Settings();// Read one key.$enabled = $settings->get_setting( 'maintenance_enabled' );// Write one key.$settings->save_setting( 'maintenance_enabled', true );
The same option is reachable from PHP, WP-CLI, and the REST API.

Migrations

On every init (priority 100) Mantle compares the version setting with MANTLE_PLUGIN_VERSION. When the stored version is older, it runs its migrations and writes the new version back. It also ensures the AI chatbot conversations table exists; that check short-circuits on a single autoloaded option read when the schema is current.

Next steps

Was this helpful?