Black Friday - Cyber Monday Sale
30% OFF All Premium Licenses
  • 00 Days
  • 00 Hrs
  • 00 Mins
  • 00 Secs
Use code
SIGMA30

This 30% discount applies only to the first year. From the second year, renewals are charged at the regular price.

How to clean Action Scheduler data (actions and logs) in Advanced Database Cleaner Premium

Younes JFR.

What is Action Scheduler data?

The Action Scheduler is a background task system used by plugins such as WooCommerce to manage automated jobs, like sending emails, syncing data, or processing background events. Over time, thousands of completed, failed, or canceled tasks (and their logs) can accumulate and inflate your database. All these items can be safely identified and cleaned using Advanced Database Cleaner Premium plugin.

How they affect your database?

Action Scheduler stores its data in the tables wp_actionscheduler_actions and wp_actionscheduler_logs. If you run a busy site or an online store, these tables can grow to hundreds of thousands of rows, slowing queries, backups, and admin performance. Cleaning these records regularly keeps your database lightweight and ensures your scheduled tasks continue to run efficiently.

How to clean them?

1. Using Advanced Database Cleaner Premium plugin

You can easily clean all Action Scheduler items using the General Cleanup module in Advanced Database Cleaner Premium plugin.

This method is safe, flexible, and fully automated. You can customize the cleanup to:

  • Delete all selected Action Scheduler data types, such as Completed actions, Pending actions, Failed logs, and others.

  • Use the Keep Last feature to retain a limited number of recent records if needed.

  • Schedule automatic cleanups so Action Scheduler data is regularly removed without manual work.

Advanced Database Cleaner Premium also automatically handles multisite installations, cleaning all Action Scheduler tables across every site in the network.

1. Completed actions

Clean using the General Cleanup module → select “Completed actions” → click Run cleanup. Or execute this SQL query directly from your phpMyAdmin:
DELETE l FROM wp_actionscheduler_logs l
JOIN wp_actionscheduler_actions a ON a.action_id = l.action_id
WHERE a.status = 'complete';
DELETE FROM wp_actionscheduler_actions WHERE status = 'complete';

2. Failed actions

Clean using the General Cleanup module → select “Failed actions” → click Run cleanup. Or execute this SQL query directly from your phpMyAdmin:
DELETE l FROM wp_actionscheduler_logs l
JOIN wp_actionscheduler_actions a ON a.action_id = l.action_id
WHERE a.status = 'failed';
DELETE FROM wp_actionscheduler_actions WHERE status = 'failed';

3. Canceled actions

Clean using the General Cleanup module → select “Canceled actions” → click Run cleanup. Or execute this SQL query directly from your phpMyAdmin:
DELETE l FROM wp_actionscheduler_logs l
JOIN wp_actionscheduler_actions a ON a.action_id = l.action_id
WHERE a.status = 'canceled';
DELETE FROM wp_actionscheduler_actions WHERE status = 'canceled';

4. Completed logs

Clean using the General Cleanup module → select “Completed logs” → click Run cleanup. Or execute this SQL query directly from your phpMyAdmin:
DELETE l FROM wp_actionscheduler_logs l
JOIN wp_actionscheduler_actions a ON a.action_id = l.action_id
WHERE a.status = 'complete';

5. Failed logs

Clean using the General Cleanup module → select “Failed logs” → click Run cleanup. Or execute this SQL query directly from your phpMyAdmin:
DELETE l FROM wp_actionscheduler_logs l
JOIN wp_actionscheduler_actions a ON a.action_id = l.action_id
WHERE a.status = 'failed';

6. Canceled logs

Clean using the General Cleanup module → select “Canceled logs” → click Run cleanup. Or execute this SQL query directly from your phpMyAdmin:
DELETE l FROM wp_actionscheduler_logs l
JOIN wp_actionscheduler_actions a ON a.action_id = l.action_id
WHERE a.status = 'canceled';

7. Orphan logs

Clean using the General Cleanup module → select “Orphan logs” → click Run cleanup. Or execute this SQL query directly from your phpMyAdmin:
DELETE FROM wp_actionscheduler_logs
WHERE action_id NOT IN (SELECT action_id FROM wp_actionscheduler_actions);

Note

While you can manually run these SQL commands, we strongly recommend performing the cleanup through Advanced Database Cleaner Premium plugin. The plugin uses WordPress’s internal cleaning methods, automatically handles multisite installations, and ensures that all related data is safely removed while keeping your Action Scheduler tables consistent and stable.