wp_delete_media is one of 214 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 214 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
MediaGet media library counts grouped by MIME type, plus a total
Retrieve 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
Pull an image from any web link straight into your media library
Step 1
Get the Plugin
Install Easy MCP AI on your WordPress site to unlock wp_delete_media and all 96 core 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.