In a recent project, I needed a quick way to bulk delete pending and failed Action Scheduler jobs directly from the WordPress dashboard—so I built a custom tool for it.
The WooCommerce > Status > Tools section is packed with useful features for debugging and maintenance, but did you know you can add your own custom tools there?
This is especially useful when your site has thousands of queued actions that are no longer needed, or if a plugin malfunction leaves behind a large number of stuck jobs. Instead of running manual SQL queries or using WP CLI, this approach gives you a simple one-click button inside your WooCommerce admin.
In this tutorial, I’ll show you how to register your own custom tool using WooCommerce’s built-in API, and how to trigger and delete all pending or failed actions.
Here’s the full snippet to get you started!

PHP Snippet: Add Custom “Tool” To Delete Action Scheduler Failed / Pending Jobs @ WooCommerce Status
This PHP snippet adds a custom tool to the WooCommerce > Status > Tools section, allowing you to bulk delete all pending Action Scheduler actions directly from the WordPress dashboard.
It registers a new tool labeled “Clean Pending Actions” using the woocommerce_debug_tools
filter. When the “Run” button is clicked, the callback runs a direct SQL query that deletes up to 10,000 rows per batch where the status
is 'pending'
, repeating until no such actions remain.
This is particularly helpful if your database contains thousands of stuck or obsolete scheduled actions, which can slow down your site or clog the Action Scheduler queue.
If you’d rather delete failed actions instead, simply change 'pending'
to 'failed'
in the SQL WHERE
clause. Be sure to also update the tool’s name and description accordingly so the admin interface reflects the correct behavior.
Use this with caution, especially on live sites, as it permanently deletes database entries!
/**
* @snippet Bulk Delete Action Scheduler Jobs
* @tutorial https://businessbloomer.com/woocommerce-customization
* @author Rodolfo Melogli, Business Bloomer
* @compatible WooCommerce 9
* @community https://businessbloomer.com/club/
*/
add_filter( 'woocommerce_debug_tools', 'bbloomer_bulk_delete_pending_scheduled_actions' );
function bbloomer_bulk_delete_pending_scheduled_actions( $tools ) {
$tools['clean_pending_actions'] = [
'name' => 'Clean Pending Actions',
'button' => 'Run',
'desc' => 'Deletes all pending Action Scheduler actions.',
'callback' => function() {
global $wpdb;
$table = $wpdb->prefix . 'actionscheduler_actions';
$batch_size = 10000;
$deleted = 0;
do {
$rows_deleted = $wpdb->query( "DELETE FROM $table WHERE status = 'pending' LIMIT $batch_size" );
$deleted += $rows_deleted;
} while ( $rows_deleted > 0 );
return sprintf( 'Deleted %d pending actions.', $deleted );
}
];
return $tools;
}
Hi Rodolfo,
i hope you don’t mind me posting this snippet. I’ve put together an enhanced version that adds support for pending, failed, and completed statuses.
Best regards,
Borko
I don’t mind at all! Thank you