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

Start free trial

Set Event Categories

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

Abilityevents/set-event-categories
ToolsetThe Events Calendar — toolset/events-calendar
GroupThe Events Calendar › Event Categories
RequiresThe Events Calendar, 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

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

NameTypeRequiredWhat it is
idintegerYesThe event ID.
term_idsarrayYesEvent category term IDs.
modestringNo — defaults to replacereplace sets exactly these, add appends, remove detaches.

What comes back

NameTypeWhat it is
categoriesarrayThe event’s categories after the change.
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:

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. Say add when you mean add.
  • Get the term IDs from events/list-event-categories.
  • An empty array with replace clears the event’s categories.
  • IDs from other taxonomies are refused, not ignored.

Related abilities


Get the plugins:
AcrossAI Abilities Manager · AcrossAI MCP Manager

Browse the rest: Every ability, by category


Keep reading