🔓 Unlock all 10,000+ workflows & prompts free Join Newsletter →
✅ Full access unlocked — explore all 10,000 AI workflow and prompt templates Browse Templates →
Home n8n Workflow
January 22, 2026

WordPress + Slack: safer bulk post and image cleanup

Lisa Granqvist Partner Workflow Automation Expert

Deleting a pile of WordPress pending posts sounds simple until you realize the cleanup doesn’t stop at the post. The featured images stick around, your Media Library bloats, and suddenly you’re doing careful, nervous click-work for an hour.

This is the kind of mess marketing managers notice during site cleanups, but agency owners and content ops teams feel it too. With WordPress Slack cleanup automation, you can remove old pending posts and their featured images, while adding a clear approval step so nothing important gets nuked by accident.

Below, you’ll see how the workflow runs, what it prevents, and how to adapt it to your own “delete rules” without turning it into a fragile one-off script.

How This Automation Works

The full n8n workflow, from trigger to final output:

n8n Workflow Template: WordPress + Slack: safer bulk post and image cleanup

The Problem: bulk deleting posts creates media mess (and risk)

When your WordPress backlog gets clogged with old pending posts, it’s tempting to select a batch and delete. But WordPress doesn’t automatically “do the right thing” with everything attached. Featured images can become orphaned files, and later you’re paying for storage, searching through a noisier library, or worse, accidentally reusing the wrong asset because the old ones never left. Add a team into the mix and it gets stressful fast. One person cleans, another person was “about to” finalize a draft, and nobody has a clean audit trail of what was removed.

It adds up fast. Here’s where it breaks down in real life:

  • Deleting 10 to 50 pending posts manually can burn about an hour, because you end up double-checking each one out of caution.
  • The Media Library keeps the featured images, which means future searches return junk you thought was gone.
  • Teams avoid cleaning altogether because nobody wants to be the person who deleted the wrong thing.
  • Even if you’re careful, small mistakes happen, and restoring a deleted post (or finding its image) is not a fun way to spend Friday afternoon.

The Solution: delete pending posts and featured images with a controllable approval layer

This n8n workflow is built for one specific outcome: clean up pending WordPress posts in bulk, without leaving featured images behind. You start it with a simple manual configuration (your WordPress URL and the search parameters that define “what counts as safe to delete”). The workflow then asks WordPress for the oldest pending posts (10 at a time by default), optionally filters the list down further, and checks each post for a featured image. If a featured image exists, it retrieves that media record first, deletes the image, and then deletes the post. If there’s no featured image, it deletes only the post. The result is a cleaner database and a Media Library that doesn’t quietly accumulate trash.

In practice, it’s a controlled pipeline. First you fetch pending posts from WordPress. Then n8n applies your “approval/filter” logic (for example, only delete the single oldest item while you test). Finally, n8n removes the featured media when it exists and deletes the post in the right order, so you don’t end up with dangling assets.

What You Get: Automation vs. Results

Example: What This Looks Like

Say you do a weekly cleanup and typically have 30 pending posts to remove. Manually, you might spend about 2 minutes per post to open, confirm status, delete, then hunt for the featured image and remove it, which is roughly an hour of focused work. With this workflow, you run it in batches of 10 posts per execution, so three runs handle the week. You spend maybe 5 minutes setting the filters and confirming what’s in scope, then n8n executes the deletions and the media cleanup for you.

What You’ll Need

  • n8n instance (try n8n Cloud free)
  • Self-hosting option if you prefer (Hostinger works well)
  • WordPress site with REST API access enabled.
  • Slack to send approval or monitoring alerts.
  • WordPress application password (create it in WP Users → Profile → Application Passwords).

Skill level: Intermediate. You’ll paste API credentials, adjust search parameters, and (optionally) tweak a small filter rule.

Don’t want to set this up yourself? Talk to an automation expert (free 15-minute consultation).

How It Works

Manual run with your site settings. You kick things off in n8n and provide the WordPress URL plus the query that defines “pending posts to fetch.” This is where you decide if you’re cleaning a specific author, category, date range, or just the oldest pending items.

WordPress returns the posts. The workflow uses an HTTP request to pull pending posts through the WordPress REST API. By default WordPress returns 10 posts, which is perfect for safe batch runs while you dial in your rules.

Your approval/filter logic runs before deletion. There’s a filter node in the workflow that can limit what gets deleted (the sample logic grabs only the first item, meaning the single oldest post). You can also swap this for a Slack approval pattern, so a human approves the deletion before the workflow continues.

Featured image cleanup happens only when needed. An “if” check looks for featured media. If it exists, the workflow retrieves the media record, deletes the image, then deletes the post. If it doesn’t exist, it deletes only the post and moves on.

You can easily modify the filter rule to delete 1 post at a time or process all 10, based on your comfort level. See the full implementation guide below for customization options.

Step-by-Step Implementation Guide

Step 1: Configure the Manual Trigger

Start the workflow with a manual trigger and define the WordPress base URL used by downstream HTTP requests.

  1. Add and open Manual Start Config.
  2. Use pinned data for testing with a JSON field like { "wpUrl": "https://setyourwordpresshere.com" }.
  3. Ensure the value is a valid WordPress site base URL because it is referenced in downstream expressions.
⚠️ Common Pitfall: If wpUrl has a trailing slash or incorrect domain, all HTTP requests will fail. Use the root domain only (e.g., https://example.com).

Step 2: Connect WordPress Data Retrieval

Fetch pending posts from WordPress using the base URL provided by the manual trigger.

  1. Open Fetch Pending Posts and set URL to ={{ $('Manual Start Config').item.json.wpUrl }}/wp-json/wp/v2/posts.
  2. In Body Parameters, add status with value pending.
  3. Add order with value asc to keep the oldest pending post first.
  4. Confirm Send Body is enabled.
⚠️ Common Pitfall: If your WordPress instance requires authentication, add the appropriate HTTP Request authentication in all WordPress request nodes (e.g., Basic Auth or OAuth) before testing.

Step 3: Set Up Filtering and Featured Media Logic

Limit the dataset to the first pending post and check whether a featured image is set.

  1. In Limit First Record, configure the condition to keep only the first item: set Left Value to ={{ $itemIndex }}, Operation to lt, and Right Value to 1.
  2. In Check Featured Image, set Left Value to ={{ $('Limit First Record').item.json.featured_media }} and Operation to notEquals with Right Value 0.
  3. Ensure the execution flow remains: Fetch Pending PostsLimit First RecordCheck Featured Image.

Step 4: Configure WordPress Deletion Actions

Delete the featured media (if present) and remove the post using the appropriate branch.

  1. In Retrieve Featured Media, set URL to ={{ $('Manual Start Config').item.json.wpUrl }}/wp-json/wp/v2/media/{{ $('Limit First Record').item.json.featured_media }}.
  2. In Remove Featured Media, set URL to ={{ $('Manual Start Config').item.json.wpUrl }}/wp-json/wp/v2/media/{{ $json.id }} and Method to DELETE.
  3. In Remove Featured Media, add body parameter force with value true and enable Send Body.
  4. In Remove Post With Media, set URL to ={{ $('Manual Start Config').item.json.wpUrl }}/wp-json/wp/v2/posts/{{ $('Limit First Record').item.json.id }}, Method to DELETE, and add body parameter force with value true.
  5. In Remove Post Only, use the same delete URL and body parameter force=true for posts with no featured media.
  6. Confirm the conditional path: Check Featured Image routes to Retrieve Featured Media (true) and Remove Post Only (false). After media deletion, Remove Featured Media proceeds to Remove Post With Media.
⚠️ Common Pitfall: WordPress REST API deletions may require authentication with delete permissions. If requests fail with 401/403, add credentials to all WordPress HTTP Request nodes.

Step 5: Test and Activate Your Workflow

Run the workflow manually to verify pending posts are removed correctly, then activate it for ongoing use.

  1. Click Execute Workflow and confirm that Fetch Pending Posts returns pending posts.
  2. Verify that Limit First Record keeps only one item and Check Featured Image routes the correct path.
  3. Confirm that posts are deleted by checking WordPress or the HTTP response from Remove Post Only or Remove Post With Media.
  4. When results are correct, save and activate the workflow for production use.
🔒

Unlock Full Step-by-Step Guide

Get the complete implementation guide + downloadable template

Common Gotchas

  • WordPress credentials can expire or lack the right capabilities. If deletion fails, check the Application Password and the user role permissions in WordPress first.
  • If you’re using Wait nodes or external rendering, processing times vary. Bump up the wait duration if downstream nodes fail on empty responses.
  • Default prompts in AI nodes are generic. Add your brand voice early or you’ll be editing outputs forever.

Frequently Asked Questions

How long does it take to set up this WordPress Slack cleanup automation?

About 30 minutes if your WordPress credentials are ready.

Do I need coding skills to automate WordPress Slack cleanup?

No. You will mainly edit a few fields and connect credentials. If you want advanced filtering, a tiny bit of logic helps, but it’s optional.

Is n8n free to use for this WordPress Slack cleanup workflow?

Yes. n8n has a free self-hosted option and a free trial on n8n Cloud. Cloud plans start at $20/month for higher volume. You’ll also need to factor in any WordPress hosting limits (some hosts throttle heavy API usage).

Where can I host n8n to run this automation?

Two options: n8n Cloud (managed, easiest setup) or self-hosting on a VPS. For self-hosting, Hostinger VPS is affordable and handles n8n well. Self-hosting gives you unlimited executions but requires basic server management.

Can I customize this WordPress Slack cleanup workflow for Slack approvals before deletion?

Yes, but you’ll want to adjust the “Limit First Record” filter logic into an approval gate. A common approach is: send a Slack message with the post title and ID, wait for an approve/reject response, then route to “Remove Post With Media” or stop the run. You can also keep the existing filter and only delete one post per run until you trust the process. Frankly, that’s the safest way to start.

Why is my WordPress connection failing in this workflow?

Usually it’s an invalid or revoked WordPress application password, or the user account doesn’t have permission to delete posts and media. Double-check the base site URL too, because a small mismatch (http vs https, or a subdirectory install) can break the REST calls. If you’re running big cleanups, rate limits from your host can also cause random-looking failures.

How many posts can this WordPress Slack cleanup automation handle?

Out of the box, it processes 10 pending posts per execution because that’s the default WordPress API page size.

Is this WordPress Slack cleanup automation better than using Zapier or Make?

Often, yes, because deleting posts and cleaning up media usually needs conditional logic and careful ordering. n8n makes it easier to branch when a post has a featured image, then run two separate delete calls safely. You also have the option to self-host, which matters if you’re running frequent maintenance jobs and don’t want per-task pricing to creep up. Zapier or Make can still work if you only need a simple “delete X items” action, but this workflow is more than that. If you’re unsure, Talk to an automation expert and describe your deletion rules.

Once you have this running, WordPress cleanup stops being a dreaded “someday” task. The workflow handles the repetitive removals, and you keep control over what gets deleted.

Need Help Setting This Up?

Our automation experts can build and customize this workflow for your specific needs. Free 15-minute consultation—no commitment required.

Lisa Granqvist

Workflow Automation Expert

Expert in workflow automation and no-code tools.

×

Use template

Get instant access to this n8n workflow Json file

💬
Get a free quote today!
Get a free quote today!

Tell us what you need and we'll get back to you within one working day.

Get a free quote today!
Get a free quote today!

Tell us what you need and we'll get back to you within one working day.

Launch login modal Launch register modal