Modules are the unit of functionality in Mantle. This guide covers inspecting what is registered, changing state safely, and understanding what does and does not disappear when a module is switched off.
Inspect current state
wp eval 'foreach ( get_option( "mantle_modules", [] ) as $m ) { printf( "%-22s %-11s %s" . PHP_EOL, $m["slug"], $m["type"], ! empty( $m["active"] ) ? "active" : "inactive" ); }'client_info core active
communication functional inactive
monitoring functional inactive
ai_chatbot functional inactive
welcome core active
maintenance functional inactive
security functional inactive
sso functional inactive
optimizations functional inactive
convergence_cache functional inactive
user_management functional inactive
dashboard core active
site_code_snippets functional inactive
white-label functional inactive
plugin_sync functional active
linchpin_licenses functional active
That is real output from a development installation. The mantle_modules option is the source of truth for enabled state; the module classes are the source of truth for what exists.
Change module state
curl -X POST \ --cookie "$COOKIE" \ -H "X-WP-Nonce: $NONCE" \ https://example.com/wp-json/mantle/v1/modules/monitoring
use Mantle\Modules\Module_Loader;Module_Loader::update_module_status( 'monitoring', true );
Mantle → Settings → ModulesToggle the module, then save.
update_module_status() is deliberately conservative. It returns early — doing nothing at all — in three cases:
When update_module_status does nothing
-
Unregistered modulestring -
Module_Loader::has()returns false. A typo in the ID fails silently rather than erroring —white_labelinstead ofwhite-labelis the common case. -
State already matchesstring -
The requested state equals
is_enabled(). This means calling it on a core module withtrueis a no-op, and withfalseis also a no-op. -
Absent from the storable liststring -
The module ID is not present in the freshly built option list.
No fields match this filter.
What disabling actually does
This is the part most worth internalising, because it is not simply "the module goes away".
Enabled versus disabled
Effect of disabling a module
-
Settings keysstring -
Still in the schema, still readable, still returned by the settings REST route. Stored values are preserved and are not reported as orphaned.
-
Capability definitionsstring -
Still listed by
get_all_capabilities(), and still granted to roles by a capability sync. They are inert because the routes are gone. -
REST routesstring -
Requests return 404 rest_no_route. The AI routes are an exception — they are controller-registered and always present.
-
Hooks and behaviourstring -
init()is never called, so nothing the module hooks takes effect. -
Admin UIstring -
The module’s tab and panels are not rendered.
No fields match this filter.
Because settings survive, disabling and re-enabling a module is non-destructive: configuration is exactly as it was.
Dependencies between modules
One dependency is enforced in code. Core\Modules::sanitize_module_settings() runs on every save of the mantle_modules option and forces ai_chatbot inactive whenever communication is inactive.
-
Enable communication
POST to
/mantle/v1/modules/communication, or toggle it in the admin UI. -
Enable ai_chatbot
Only now will it persist. Attempting it first appears to succeed but the sanitiser reverts it.
-
Configure a provider
The chat surface also requires
Provider_Manager::is_configured()to return true, in addition to themantle_access_chatbotcapability.
The write succeeds and the response is a success, but the sanitiser sets active back to false before the option is stored. Re-read /mantle/v1/modules to confirm the state actually persisted.
Verify after a change
wp eval 'echo \Mantle\Modules\Module_Loader::get( "monitoring" )->is_enabled() ? "enabled" : "disabled", PHP_EOL;'
wp mantle settings auditdisabled
Option: mantle
Schema keys: 102
Saved keys: 102
Missing schema keys: 0
Orphaned saved keys: 0
Success: Settings audit passed. Saved keys match the registered schema.
Note the key count does not drop when a module is disabled — further confirmation that schema registration is independent of module state.
See also
- Module reference — every module and what it owns.
- Creating a module.