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

Start free trial

Trash Venue

events/trash-venue moves a venue to the trash. It refuses without confirm: true.

It reports how many events still link to the venue, because nothing else is going to tell you.

Before you run it

Events linked to this venue are not updated. The calendar leaves them pointing at a trashed post, and their venue section goes blank on the front end. The response tells you how many events are affected, but it tells you as it acts — read the count with events/list-events first if you want to decide before anything moves.

At a glance

Abilityevents/trash-venue
ToolsetThe Events Calendar — toolset/events-calendar
GroupThe Events Calendar › Venues
RequiresThe Events Calendar, active on the site
Capabilitymanage_options
SafetyDestructive — moves the post to the trash, and refuses to run without confirm: true. Recoverable from the WordPress trash.
RepeatableNot idempotent — each call changes the row set, so re-running is not a no-op
Ships inAcrossAI Abilities Manager 0.0.34 and later

How it works

The Events Calendar does not clean up after a trashed venue. Events keep the venue ID in their meta, the venue post is in the trash, and the event page renders with an empty venue section. No warning in the admin, no notice anywhere.

So the count comes back with the result: how many events were pointing at this venue when it went. On a calendar with years of history that number is often much larger than the person asking expects, and it is the number that tells you whether this was a tidy-up or a mistake.

Trash only, never permanent deletion — for the same reason as events. A venue is a custom post type, and WordPress will not auto-trash one; the default deletion path would remove it and its meta outright.

Input

NameTypeRequiredWhat it is
idintegerYesThe venue ID.
confirmbooleanYes — must be trueThe irreversibility gate. Without it the call is refused before anything is touched.

What comes back

NameTypeWhat it is
idintegerThe venue ID.
trashedbooleanWhether the move succeeded.
linked_eventsintegerHow many events still reference this venue.
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:

Remove the duplicate venue 311.

It resolves to one call:

{
  "ability": "events/trash-venue",
  "parameters": {
    "id": 311,
    "confirm": true
  }
}

Worth knowing

  • Repoint the events first. events/update-event can move each one to the venue you are keeping.
  • A non-zero linked_events means that many event pages now show no venue.
  • Restore from the trash in the admin if the count was a surprise — the links are still there, so restoring fixes them.

Related abilities

  • List Events — count the affected events before you act
  • Update Event — repoint events at the venue you are keeping

Get the plugins:
AcrossAI Abilities Manager · AcrossAI MCP Manager

Browse the rest: Every ability, by category


Keep reading