snippets/update-snippet-from-library replaces an installed snippet with the newer version from the library. It refuses without confirm: true.
It keeps whatever active state the snippet had here — which is a deliberate departure from what the plugin’s own updater does.
At a glance
| Ability | snippets/update-snippet-from-library |
| Toolset | WPCode — toolset/wpcode |
| Group | WPCode › The Library |
| Requires | WPCode, active on the site |
| Capability | manage_options |
| Safety | Writes data |
| Repeatable | Not idempotent — each call changes the row set, so re-running is not a no-op |
| Ships in | AcrossAI Abilities Manager 0.0.34 and later |
Local edits are lost
This overwrites the snippet’s code completely. Any local edit — a changed threshold, a removed line, a fix somebody made here — is lost, and there is no copy kept. Read the snippet with snippets/get-snippet first if there is any chance it was modified after installation.
Why the active state is preserved
WPCode’s own updater takes the active state from the library payload. So a snippet you deliberately switched off — because it conflicted with something, or because you were mid-investigation — comes back on as a side effect of an update, and nothing reports it.
That is a surprising thing for an update to do. This ability reads the local state before the write and restores it afterwards, so updating changes the code and only the code.
The code itself is replaced wholesale. There is no merge, and local modifications are not detected or preserved — which is the reason for the confirmation, and the reason to read the snippet first if anybody might have edited it here.
If the updated code is PHP and the snippet was active, WPCode’s activation check runs again on save. A new version that errors leaves the snippet off, and the response reports that rather than claiming a clean update.
Input
| Name | Type | Required | What it is |
|---|---|---|---|
id | integer | Yes | Local snippet ID, from snippets/list-snippet-updates. |
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 update. |
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:
Pull the latest version of snippet 88 from the library.
It resolves to one call:
{
"ability": "snippets/update-snippet-from-library",
"parameters": {
"id": 88,
"confirm": true
}
}Worth knowing
- Local edits are overwritten with no copy kept.
- The local active state is preserved — a deliberately disabled snippet stays disabled.
- An updated PHP snippet can fail the activation check and end up off. The response says so.
- Requires the site to be signed in to the library.
Related abilities
- List Snippet Updates — find what is out of date
- Duplicate Code Snippet — keep a copy of local edits first
Get the plugins:
AcrossAI Abilities Manager · AcrossAI MCP Manager
Browse the rest: Every ability, by category