Governed ability

Delete media

aafm/delete-media Guarded write

Permanently delete an attachment - the file and library entry are removed and cannot be recovered.

How it is governed

The same model as every ability in the plugin, stated for this one.

  • Off until you enable it

    Like every ability, Delete media ships switched off. You turn it on one at a time, and an update never widens access on its own.

  • Guarded write

    Writes stay conservative, and the plugin re-checks the capability before the call runs.

  • Capability gated

    A connection only sees Delete media if the user you connected can run it, and the plugin checks that capability again before it executes.

  • Every call audited

    The call is written to the log in your own database, denials included, with the argument keys but never the values.

  • It can delete

    This ability can delete. Where WordPress supports it, items go to Trash and can be restored, and the last administrator can never be removed.

See it in action

An illustrative run. Your real calls and data stay on your own site.

agent-abilities · audit Governed
You Delete media on this site.
Run Running aafm/delete-media
Gate Allowed capability re-checked before running
Audit aafm/delete-media · principal: editor · args: attachment_id
Result Removes the item where allowed, to Trash where WordPress supports it, then logs the call.

Try it with a prompt

Example requests you could paste to your agent.

  1. Delete attachment 512 from the media library.
  2. Permanently remove media item 341 that we no longer use.
  3. Delete the old logo file, attachment 88, from the library.

These are illustrative example prompts. The agent runs them as the user you connected, checked against that user's capabilities and written to your audit log.

Frequently asked

Short answers for Delete media.

Can a deleted attachment be recovered?

No. Deleting media permanently removes both the file and its library entry, and it cannot be undone. Media deletion does not go to the Trash, so use it deliberately.

What controls this destructive action?

It is a guarded, capability-gated write that stays off by default until an administrator enables it, and every deletion is recorded in the audit log.

Back to all abilities

Governed by default, from the first call.

Delete media is off until you enable it, scoped to the user you connect, and logged like everything else. Turn on only what you need.

Every ability off until you enable it, capability-gated on every call.