snippets/update-global-scripts replaces the site-wide header, body or footer script. Send only the slots you want to change.
Each slot you send is replaced in full. There is no append.
At a glance
| Ability | snippets/update-global-scripts |
| Toolset | WPCode — toolset/wpcode |
| Group | WPCode › Global Scripts |
| 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 |
Every page, and a full replacement
This markup runs on every page of the site, including checkout and login. There is no location, no conditional logic and no active flag to limit it — whatever goes in here is on every request. And each slot is replaced wholesale: sending a new header script discards the existing one entirely, which is how analytics tags get removed by accident.
Replacement, not merge
The value you send becomes the slot’s entire contents. That is the right primitive — it is unambiguous and it makes the operation idempotent — but it means “add our new analytics tag to the header” is a read-then-write, not a single call.
Read the current value with snippets/get-global-scripts, append to it, send the result. Skipping the read is how a site loses a tag that had been there for years.
Slots you do not send are untouched, so changing the footer cannot disturb the header.
The body slot depends on the theme calling wp_body_open. Writing to it on a theme that does not is accepted and does nothing; the read ability reports whether the theme supports it.
For anything that needs a location, a condition or an off switch, a snippet is the better home. These three fields are for markup that genuinely belongs on every page.
Input
| Name | Type | Required | What it is |
|---|---|---|---|
header | string | No | Markup for the site head. Replaces the current value entirely. |
body | string | No | Markup for just after the opening body tag. Only rendered by themes that call wp_body_open. |
footer | string | No | Markup for the site footer. Replaces the current value entirely. |
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 |
|---|---|---|
header | string | The header slot after the write. |
body | string | The body slot after the write. |
footer | string | The footer slot after the write. |
updated | array | Which slots were changed. |
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:
Add our new analytics tag to the site header.
It resolves to one call:
{
"ability": "snippets/update-global-scripts",
"parameters": {
"header": "<!-- existing tags -->\n<script src=\"https://example.com/a.js\"></script>",
"confirm": true
}
}Worth knowing
- Read before you write. The slot is replaced, not appended to.
- Slots you omit are left alone.
- This markup has no conditions and no off switch. A snippet does.
- Idempotent — the same payload twice leaves the same result.
Related abilities
- Get Global Header and Footer Scripts — read before appending
- Create Code Snippet — when it should not run everywhere
Get the plugins:
AcrossAI Abilities Manager · AcrossAI MCP Manager
Browse the rest: Every ability, by category