What This Workflow Does
Managing WordPress content often requires bulk deletion of outdated posts, especially for news sites, event calendars, or temporary promotions. Manual deletion becomes impractical when dealing with hundreds of posts, risking incomplete removal of associated media files that continue consuming server space.
This automation solves two key problems simultaneously: it deletes WordPress posts in bulk while also removing their featured images from the media library. The workflow handles the entire process through API calls to your WordPress installation, ensuring no orphaned files remain.
How It Works
1. Post Retrieval
The workflow first queries your WordPress REST API to retrieve posts matching your criteria (date range, category, or custom fields). This creates a targeted list for deletion.
2. Media Identification
For each post, the system extracts the featured image ID and prepares it for deletion alongside the post content.
3. Batch Processing
The workflow processes posts in controlled batches, deleting both the post content and its featured image through sequential API calls. Error handling ensures skipped items don't halt the entire process.
4. Confirmation Logging
Each successful deletion generates a log entry with timestamps and post details. Failed deletions trigger notification alerts for manual review.
Who This Is For
This automation benefits WordPress administrators, content managers, and digital agencies managing multiple client sites. Common use cases include:
- Seasonal content cleanup (expired promotions, events)
- Website rebranding requiring content removal
- Compliance with right-to-be-forgotten requests
- Pre-launch staging site cleanup
What You'll Need
- WordPress installation with REST API enabled
- Administrator credentials or API keys with delete permissions
- n8n instance or account (self-hosted or cloud)
- List of posts to delete (or criteria for selection)
Quick Setup Guide
- Import the JSON template into your n8n instance
- Configure WordPress API connection parameters
- Set your post selection criteria (dates, categories, etc.)
- Run a test with 2-3 posts to verify functionality
- Schedule or trigger the full batch process
Key Benefits
Time Savings: What typically takes hours of manual work completes in minutes. A 500-post cleanup that might require a full day manually finishes in under 30 minutes.
Storage Recovery: The workflow reclaims server space by removing both posts and their media files, unlike manual deletion which often leaves orphaned attachments.
Error Reduction: Automated processing eliminates human mistakes like skipping posts or missing associated files during manual cleanup.
Audit Trail: Detailed logs provide documentation of what was deleted and when, useful for compliance and team accountability.
Pro tip: Before running large deletions, export a backup of your posts or run the workflow in stages to monitor performance impact.