snippets/activate-snippet switches a snippet on.
For PHP and universal snippets it reads the state back afterwards, because WPCode’s own save path can refuse an activation without saying so.
At a glance
| Ability | snippets/activate-snippet |
| Toolset | WPCode — toolset/wpcode |
| Group | WPCode › Snippets |
| Requires | WPCode, 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 |
This is the moment code starts running
Activating is the moment the code starts running on the live site. For PHP and universal snippets that means arbitrary code executing on every matching request, which is why the confirmation is here rather than on creation.
The quiet refusal
WPCode test-runs PHP and universal code before letting a snippet go live. If the code errors, it leaves the snippet switched off — and still reports the save as successful. The snippet is not running, the caller was told it worked, and the only trace is an error recorded against the snippet.
This ability reads the state back after the write. When the activation was refused it returns activation_refused with the recorded error, rather than reporting a snippet as live when it is not.
Idempotent: activating something already active changes nothing.
The cache flag in the response is the confirmation that matters. Active and cached means running; active and not cached means something is wrong with the cache, and snippets/get-snippet-status will say what.
Input
| Name | Type | Required | What it is |
|---|---|---|---|
id | integer | Yes | Snippet ID. |
confirm | boolean | Yes — must be true | The irreversibility gate. Without it the call is refused before anything is touched. |
What comes back
| Name | Type | What it is |
|---|---|---|
snippet | object | The snippet after the attempt, including whether the activation was refused and why. |
in_cache | boolean | Whether WPCode’s loader cache holds the snippet. This, not the post status, is what decides whether it actually runs. |
safe_mode | boolean | Whether safe mode is active. When it is, no snippet runs regardless of everything else. |
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:
Switch on the snippet I just created.
It resolves to one call:
{
"ability": "snippets/activate-snippet",
"parameters": {
"id": 88,
"confirm": true
}
}Worth knowing
activation_refusedmeans the code errored during WPCode’s check. The snippet is still off.- Safe mode suppresses everything. A snippet can activate cleanly and still not run.
- Idempotent.
- Deactivating needs no confirmation — only switching code on does.
Related abilities
- Deactivate Code Snippet — the reverse, with no gate
- Get Snippet System Status — if it activated but nothing happens
- List Snippet Errors — read the refusal reason
Get the plugins:
AcrossAI Abilities Manager · AcrossAI MCP Manager
Browse the rest: Every ability, by category