rank-math/set-module-state enables or disables one Rank Math module.
It also refreshes rewrite rules and fires Rank Math’s module-changed action, which is what makes it a repair as well as a toggle.
At a glance
| Ability | rank-math/set-module-state |
| Toolset | Rank Math — toolset/rank-math |
| Group | Rank Math › Modules & Permissions |
| Requires | Rank Math SEO, active on the site |
| Capability | manage_options |
| Safety | Writes data |
| Repeatable | Idempotent — running it twice leaves the same result |
| Ships in | AcrossAI Abilities Manager 0.0.34 and later |
The two steps a plain toggle skips
Flipping the module option is the easy part. The sitemap and llms.txt modules register rewrite rules, and those rules only exist once they have been flushed into the persisted rules — so a module switched on without that step reports itself active and its route returns 404.
The module-changed action is the other step. Several parts of Rank Math listen for it to set up or tear down their own state, and a module toggled without firing it ends up half configured.
Both together are why toggling the sitemap module off and on is the standard fix for a sitemap that 404s. It is not superstition — it is the flush.
Discover the available slugs with rank-math/list-modules, which also marks the modules that cannot be enabled on this install.
Disabling a module does not delete its data. Redirections survive the redirections module being switched off; they simply stop being applied.
Idempotent.
Input
| Name | Type | Required | What it is |
|---|---|---|---|
module | string | Yes | The module slug, from rank-math/list-modules. |
enabled | boolean | Yes | Whether the module is on. |
What comes back
| Name | Type | What it is |
|---|---|---|
module | string | The module changed. |
enabled | boolean | Its state afterwards. |
rewrite_rules_refreshed | boolean | Whether rules were flushed. |
success | boolean | Whether the call completed. |
message | string | A one-line summary of what happened, suitable for showing a human. |
error_code | string | Present only on failure — a stable machine-readable reason, such as a missing field, a wrong field type or an unmet confirmation. |
Example
Ask your assistant:
Turn the sitemap module off and on to fix the 404.
It resolves to one call:
{
"ability": "rank-math/set-module-state",
"parameters": {
"module": "sitemap",
"enabled": true
}
}Worth knowing
- Refreshes rewrite rules, which is why it fixes sitemap and llms.txt 404s.
- A plain option toggle would not do either extra step.
- Disabling keeps the module’s data.
- Idempotent.
Related abilities
- List Rank Math Modules — find the slug
- Get Rank Math Sitemap Status — confirm the route works
- Refresh Rank Math llms.txt Route — the narrower repair
Get the plugins:
AcrossAI Abilities Manager · AcrossAI MCP Manager
Browse the rest: Every ability, by category