wp_delete_media is one of 162 MCP tools included in Easy MCP AI — the WordPress plugin that connects Claude, ChatGPT, and any AI assistant to your site.
Install Free Plugin →wp_delete_media
DestructiveDescription
Bloated media libraries slow WordPress sites down and inflate storage costs — Easy MCP AI gives your AI client the power to clean them up without ever logging into the dashboard. Your AI will list and filter media first to confirm the correct file IDs, then issue the deletion through Easy MCP AI's secure MCP server. Because the deletion is permanent, Easy MCP AI's per-token tool permissions let you restrict this destructive tool to trusted AI sessions only, keeping accidental removals off the table.
See it in action
wp_list_media Fetching unattached media older than 2 years…
{
"total": 3,
"items": [
{ "media_id": 44, "filename": "banner-2021.jpg", "uploaded": "2021-08-12", "attached": false },
{ "media_id": 51, "filename": "promo-old.png", "uploaded": "2021-11-03", "attached": false },
{ "media_id": 63, "filename": "team-2022.jpg", "uploaded": "2022-02-19", "attached": false }
]
} wp_delete_media {
"deleted": 3,
"items": [
{ "media_id": 44, "filename": "banner-2021.jpg" },
{ "media_id": 51, "filename": "promo-old.png" },
{ "media_id": 63, "filename": "team-2022.jpg" }
]
} Found 3 unattached images older than 2 years (IDs #44, #51, #63). All 3 have been permanently deleted from your media library.
Example Use Cases & Sample Prompts
- Removing obsolete files
- Prompt: “Find all images uploaded more than 2 years ago that aren’t attached to any post, and delete them.”
- Cleanup after redesign
- Prompt: “List all images with ‘old-logo’ in the filename and delete them.”
- Removing duplicates
- Prompt: “I accidentally uploaded ‘banner.jpg’ twice — find and delete the older duplicate.”
- Post-event cleanup
- Prompt: “Delete all images related to the ‘Christmas 2023’ promotion from the media library.”
- Storage cleanup
- Prompt: “List unattached media files and delete the ones that haven’t been used in any page or post.”
Frequently Asked Questions
What does wp_delete_media do?
Bloated media libraries slow WordPress sites down and inflate storage costs — Easy MCP AI gives your AI client the power to clean them up without ever logging into the dashboard. Your AI will list and filter media first to confirm the correct file IDs, then issue the deletion through Easy MCP AI's secure MCP server. Because the deletion is permanent, Easy MCP AI's per-token tool permissions let you restrict this destructive tool to trusted AI sessions only, keeping accidental removals off the table.
How do I use wp_delete_media with my AI assistant?
Install the Easy MCP AI WordPress plugin, generate an API token in your dashboard, and connect your AI client (Claude, ChatGPT, Cursor, or any MCP-compatible assistant). Then simply describe what you want in natural language — for example: "Find all images uploaded more than 2 years ago that aren't attached to any post, and delete them."
Do I need Easy MCP AI to use wp_delete_media?
Yes. wp_delete_media is one of 162 MCP tools bundled inside the Easy MCP AI WordPress plugin. Install the free plugin from WordPress.org, connect your AI client, and this tool becomes available immediately — no coding required.
Related Tools
MediaRetrieve the full metadata of a specific media file by ID
Browse and search the WordPress media library by type, keyword, or date
Update the title, alt text, caption, or description of a media file by ID
Upload an image or file from a URL directly into the WordPress media library
Step 1
Get the Plugin
Install Easy MCP AI on your WordPress site to unlock wp_delete_media and all 74 tools instantly.
Step 2
Connect Your AI Client
Already have the plugin? Step-by-step setup guides for Claude, ChatGPT, Cursor, Windsurf, and 10+ more.