events/set-event-categories assigns event categories to an event in one of three modes: replace the current set, add to it, or remove from it.
Unknown term IDs are refused, and the refusal names them.
At a glance
| Ability | events/set-event-categories |
| Toolset | The Events Calendar — toolset/events-calendar |
| Group | The Events Calendar › Event Categories |
| Requires | The Events Calendar, 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 |
Three modes, because replace is not always what was meant
The WordPress term-assignment function replaces by default. That is the right behaviour about half the time and quietly wrong the other half: “tag this as a workshop” usually means add, not “make workshop the only category it has”. The mode is explicit here so the difference is stated rather than assumed.
replace sets exactly the terms given. add appends, leaving existing ones alone. remove detaches the terms given and leaves the rest.
Term IDs are validated against the event-category taxonomy before anything is written. WordPress will accept an ID from a different taxonomy and silently do nothing useful with it — a post-category ID passed here would vanish without complaint. Checking first turns that into a refusal that names the bad ID.
All three modes are idempotent. Adding a category twice leaves it attached once; removing one that is not there is a no-op.
Input
| Name | Type | Required | What it is |
|---|---|---|---|
id | integer | Yes | The event ID. |
term_ids | array | Yes | Event category term IDs. |
mode | string | No — defaults to replace | replace sets exactly these, add appends, remove detaches. |
What comes back
| Name | Type | What it is |
|---|---|---|
categories | array | The event’s categories after the change. |
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:
Tag event 1840 as a workshop as well, without losing its other categories.
It resolves to one call:
{
"ability": "events/set-event-categories",
"parameters": {
"id": 1840,
"term_ids": [42],
"mode": "add"
}
}Worth knowing
- The default is
replace. Sayaddwhen you mean add. - Get the term IDs from
events/list-event-categories. - An empty array with
replaceclears the event’s categories. - IDs from other taxonomies are refused, not ignored.
Related abilities
- List Event Categories — find the term IDs
- Get Event — see what it has now
Get the plugins:
AcrossAI Abilities Manager · AcrossAI MCP Manager
Browse the rest: Every ability, by category