---
title: "Clean Up WooCommerce Action Scheduler: Fix a Bloated actionscheduler Table"
description: "Shrink a bloated Action Scheduler table in WooCommerce: find what's piling up, fix failing and stuck actions, purge old rows safely, and keep it clean."
url: https://adnanshawkat.me/blog/clean-up-woocommerce-action-scheduler/
---

[← All posts](https://adnanshawkat.me/blog/)

# How to Clean Up WooCommerce Action Scheduler Without Breaking Your Store

19 November 2026 · WooCommerce · WordPress · Performance · Maintenance

![An overflowing filing cabinet spilling thousands of small task cards, with an arrow to a slim, tidy cabinet, a broom sweeping up the leftovers, a stopwatch, a shopping cart and a database icon](https://adnanshawkat.me/images/blog/woocommerce-action-scheduler-cleanup.webp)

Open the database of almost any WooCommerce store that’s a few years old and sort the tables by size. Near the top, often above the orders, you’ll find `wp_actionscheduler_actions` and `wp_actionscheduler_logs`.

Action Scheduler is the background job queue that ships with WooCommerce. Subscription renewals, webhooks, emails from marketing plugins, analytics imports, feed generators and a long list of other plugins push their work through it. When it’s healthy you never think about it. When it isn’t, you get millions of rows, slow admin pages, a “past-due actions” warning, and renewals or syncs that quietly stop happening.

The fix isn’t “truncate the table”. Some of those rows are jobs your store still needs to run. Here’s how I clean it up on client stores.

## How Action Scheduler works

Every job is a row in `wp_actionscheduler_actions` with a hook name, arguments, a scheduled date, a group and a status: pending, in-progress, complete, failed or canceled. Each time a job is created, started, finished or fails, a line is written to `wp_actionscheduler_logs`.

A queue runner picks up due pending actions in small batches. By default it’s triggered by WP-Cron and by async requests during admin page loads, which is why low-traffic stores and sites with broken cron fall behind.

Old rows are supposed to clean themselves up. A built-in cleaner deletes completed and canceled actions after about a month. How well that works depends on your version:

-   **Before Action Scheduler 4.0.0**, failed actions were never cleaned up by default, so they piled up forever. Cleanup also ran in small slices on each queue batch, so on busy stores it often fell behind
-   **From 4.0.0** (bundled with WooCommerce 11.0), failed actions are purged after 3 months, and cleanup runs as its own daily job at 3 am site time, in larger batches, until the backlog is clear

Even on 4.0, the cleaner can’t fix a plugin that’s failing thousands of times a day, and it won’t clear years of history that built up before you updated if the queue barely runs. You can check your version under **WooCommerce → Status**, where Action Scheduler is listed with its version and data store.

## Step 1: See what’s actually in there

Start in the admin at **WooCommerce → Status → Scheduled Actions** (or **Tools → Scheduled Actions**). The status tabs at the top show the counts for each status. Write them down. They’re your before numbers.

For a clearer picture, group by hook and status in the database. On staging or with a read-only query:

```
SELECT hook, status, COUNT(*) AS total
FROM wp_actionscheduler_actions
GROUP BY hook, status
ORDER BY total DESC
LIMIT 20;
```

Swap `wp_` for your table prefix. Usually one or two hooks account for almost everything. That tells you which plugin is responsible, and whether the problem is old history or something that’s still generating rows every minute.

## Step 2: Take a backup first

Same rule as any database work: take a full backup before you delete anything, and try the cleanup on a staging copy if the store is large or busy. You’re not touching orders, but a mistake with pending actions can cancel subscription renewals or scheduled syncs.

## Step 3: Fix what’s failing before you delete it

Open the **Failed** tab and look at the log for a few of the most common hooks. The message usually tells you what went wrong: a missing class from a deactivated plugin, an API key that expired, a timeout, a PHP error.

Deleting failed actions without fixing the cause only hides the problem until the table fills up again. Typical fixes:

-   Hooks from a plugin you’ve removed: the plugin left its schedule behind, so the rows can go
-   Hooks failing on an external API: renew the key or fix the connection, then let new actions run
-   Timeouts on large batches: lower the plugin’s batch size if it has a setting, or raise the PHP time limit for cron

Also check the **Pending** tab for actions with a scheduled date far in the past. A large pile of past-due actions means the queue runner isn’t running often enough, which brings us to cron.

## Step 4: Make sure the queue actually runs

If WP-Cron only fires when someone visits the site, Action Scheduler falls behind on quiet stores and competes with customers on busy ones. On most client stores I turn off the visitor-triggered cron and run it from the server instead.

In `wp-config.php`:

```
define( 'DISABLE_WP_CRON', true );
```

Then add a real cron job on the server, every minute or every five:

```
*/5 * * * * cd /path/to/site && wp cron event run --due-now --quiet
```

If your host doesn’t offer WP-CLI, a cron job that requests `https://example.com/wp-cron.php` does the same thing. To work through a backlog faster, you can also run the queue directly:

```
wp action-scheduler run --batch-size=100
```

## Step 5: Purge old rows safely

Once the cause is fixed, clear the history. Action Scheduler 3.6 and newer include a WP-CLI command that deletes by status and age, in batches:

```
wp action-scheduler clean --status=complete,canceled,failed --before="30 days ago" --batch-size=500
```

Batches matter on big tables. Deleting a few million rows in a single query can lock the table and slow checkout while it runs. Run it during a quiet hour and watch the server load.

Leave pending actions alone unless you know exactly what they are. Those are jobs still waiting to run, like next month’s subscription renewals.

Log lines are normally removed along with their actions, but it’s worth checking for orphans left behind by older versions or interrupted deletes:

```
SELECT COUNT(*) FROM wp_actionscheduler_logs l
LEFT JOIN wp_actionscheduler_actions a ON a.action_id = l.action_id
WHERE a.action_id IS NULL;
```

If that number is large, delete those rows in batches on staging first. And if the tables are still big on disk afterwards, run `OPTIMIZE TABLE` on both during a quiet window to reclaim the space.

## Step 6: Keep it from coming back

On Action Scheduler 4.0 or newer, the built-in cleaner already handles failed actions. If you want shorter windows, two filters in a must-use plugin or your custom functionality plugin do it:

```
// Keep completed and canceled actions for 14 days instead of about a month.
add_filter( 'action_scheduler_retention_period', function () {
    return 14 * DAY_IN_SECONDS;
} );

// Keep failed actions for 30 days instead of 3 months (Action Scheduler 4.0+).
add_filter( 'action_scheduler_retention_period_for_failed', function () {
    return 30 * DAY_IN_SECONDS;
} );
```

On an older version, add failed actions to the cleaner yourself:

```
add_filter( 'action_scheduler_default_cleaner_statuses', function ( $statuses ) {
    $statuses[] = ActionScheduler_Store::STATUS_FAILED;
    return $statuses;
} );
```

Keep the retention period long enough that you can still debug a problem after you notice it. Two weeks is a good balance for most stores.

Then check the Scheduled Actions screen once a month as part of routine maintenance. If one hook starts growing again, you’ll catch it at thousands of rows instead of millions.

## FAQ

### Is it safe to delete Action Scheduler data?

Completed, canceled and old failed actions are history, and deleting them is safe once you have a backup. Don’t delete pending actions blindly, because they include future jobs like subscription renewals.

### Can I just truncate the actionscheduler tables?

You can, but you’ll lose every pending action along with the history. On a store with subscriptions or scheduled syncs, that means missed renewals and jobs that never run. Clean by status instead.

### Why does WooCommerce say I have past-due actions?

The queue runner isn’t keeping up, usually because WP-Cron isn’t firing often enough. Move cron to a real server cron job and check for actions that fail or time out.

### Will cleaning Action Scheduler speed up my store?

Usually the admin gets faster first, especially the orders, Scheduled Actions and analytics screens. Smaller tables also mean faster backups and less database load during cron runs.

## Need a hand?

If your store’s database is full of scheduled actions and you’re not sure which ones are safe to remove, I can audit it, fix what’s failing, and set up a proper cron and cleanup routine. [Get in touch](https://adnanshawkat.me/contact/) or see my [services](https://adnanshawkat.me/services/).

Agency looking after a fleet of WooCommerce stores? [Betatech](https://betatech.co) works as your white-label WordPress team, NDA included.

[← Previous post**How to Move WooCommerce to the Checkout Block Without Breaking Checkout**](https://adnanshawkat.me/blog/move-woocommerce-to-checkout-block/) [Next post →**How to Fix Bloated Autoloaded Options in WordPress and WooCommerce**](https://adnanshawkat.me/blog/fix-autoloaded-options-wordpress-woocommerce/)

## Questions about this post?

Or a store that needs the same kind of work? Send me a message and I’ll reply within one business day.

[Contact me →](https://adnanshawkat.me/contact/) [See services](https://adnanshawkat.me/services/)
