30 days free. No credit card. Full access from the moment you connect your site.

Start free trial

Set Snippet Location

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

Abilitysnippets/set-location
ToolsetWPCode — toolset/wpcode
GroupWPCode › Placement
RequiresWPCode, active on the site
Capabilitymanage_options
SafetyWrites data
RepeatableIdempotent — running it twice leaves the same result
Ships inAcrossAI 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

NameTypeRequiredWhat it is
idintegerYesSnippet ID.
locationstringYesWhere the snippet should be inserted. From snippets/list-locations.
auto_insertbooleanNoWhether WPCode inserts the snippet automatically at that location. False keeps the location but renders only via the shortcode.

What comes back

NameTypeWhat it is
snippetobjectThe snippet after the write.
in_cachebooleanWhether WPCode’s loader cache holds the snippet. This, not the post status, is what decides whether it actually runs.
safe_modebooleanWhether safe mode is active. When it is, no snippet runs regardless of everything else.
successbooleanWhether the call completed.
messagestringA one-line summary of what happened, suitable for showing a human.
error_codestringPresent 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_insert false 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


Get the plugins:
AcrossAI Abilities Manager · AcrossAI MCP Manager

Browse the rest: Every ability, by category


Keep reading