πŸ”§ Batch Delete Posts and Featured Images in WordPress

⚑ 220 views Β· πŸ”§ Miscellaneous

Description

Why use this

You need to delete (many) posts on a WordPress website and also delete the featured image associated with each post.

Hours of rote work cut into a fraction with this automation.

How it works

What you can expect

Notes on Filter/Approval

This is arbitrary and depends on your own use case. Maybe you have an editor who needs to approve the post deletion. You might want to get approval by email, slack msg or ticketing system.

Or maybe you just want to monitor the process and spare specific posts from deletion.

I used the Filter node to only grab the first item (itemIndex < 1) which in this case was the oldest pending post.

This could also be expanded to two separate workflows:

This would require another HTTP request, similar to the DELETE post request, that instead publishes the post.

πŸ”— Nodes Used

HTTP Request, Filter

πŸ“₯ Import

Download workflow.json and import into n8n: Workflow menu β†’ Import from File

πŸ“– Importing guide Β· πŸ”‘ Credential setup