snippets/set-location sets where a snippet is inserted, and whether it is inserted automatically at all.
An unrecognised location is refused by name rather than saved.
At a glance
| Ability | snippets/set-location |
| Toolset | WPCode — toolset/wpcode |
| Group | WPCode › Placement |
| 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 |
Refusing rather than storing
WPCode will store any string as a location. It just never inserts the snippet if it does not recognise it — and nothing anywhere reports the problem. The snippet is active, in the cache, and invisible.
That is a bad failure to hand an assistant, which is why the value is checked against the known locations first and a wrong one comes back named. Read snippets/list-locations for the accepted set.
The auto_insert flag is the separate question of whether WPCode places the snippet for you. Set it false to keep a location recorded while rendering the snippet only through its shortcode — useful for a snippet you want to place by hand in one template.
Idempotent.
Input
| Name | Type | Required | What it is |
|---|---|---|---|
id | integer | Yes | Snippet ID. |
location | string | Yes | Where the snippet should be inserted. From snippets/list-locations. |
auto_insert | boolean | No | Whether WPCode inserts the snippet automatically at that location. False keeps the location but renders only via the shortcode. |
What comes back
| Name | Type | What it is |
|---|---|---|
snippet | object | The snippet after the write. |
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:
Put snippet 88 in the site footer.
It resolves to one call:
{
"ability": "snippets/set-location",
"parameters": {
"id": 88,
"location": "site_footer"
}
}Worth knowing
- Read the location list first. The identifiers are not guessable.
auto_insertfalse means the snippet renders only where its shortcode is placed.- Idempotent.
- A snippet that is active, cached and still invisible is usually a location or a conditional-logic problem.
Related abilities
- List Auto-Insert Locations — the accepted values
- Set Snippet Conditional Logic — the other reason it may not show
Get the plugins:
AcrossAI Abilities Manager · AcrossAI MCP Manager
Browse the rest: Every ability, by category