snippets/duplicate-snippet copies a snippet. The copy is inactive, with Copy appended to its title.
It uses WPCode’s own duplicate routine, which matters more than it sounds.
At a glance
| Ability | snippets/duplicate-snippet |
| Toolset | WPCode — toolset/wpcode |
| Group | WPCode › Snippets |
| 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 |
Why the copy routine, and not a read-then-write
Copying a snippet by reading its code and writing it back is where backslashes go to die. WordPress slashes and unslashes data on the way through its own save path, and code — regular expressions especially — is full of backslashes that a round trip quietly halves.
WPCode’s duplicate routine copies the stored value directly, so the copy is byte-for-byte the original. A regex that worked in the source works in the copy.
Inactive by default, which makes duplication the safe way to experiment: copy the working snippet, edit the copy, activate it, and the original is untouched the whole time.
Not idempotent — each call produces another copy.
Input
| Name | Type | Required | What it is |
|---|---|---|---|
id | integer | Yes | Snippet ID. |
What comes back
| Name | Type | What it is |
|---|---|---|
snippet | object | The new copy. |
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:
Make me a copy of snippet 88 so I can edit it safely.
It resolves to one call:
{
"ability": "snippets/duplicate-snippet",
"parameters": {
"id": 88
}
}Worth knowing
- The copy is inactive. Nothing starts running.
- Code is preserved exactly, including backslashes.
- Not idempotent. Two calls, two copies.
- The safe way to try a change to a snippet that is currently working.
Related abilities
- Update Code Snippet — edit the copy
- Activate Code Snippet — switch the copy on
Get the plugins:
AcrossAI Abilities Manager · AcrossAI MCP Manager
Browse the rest: Every ability, by category