Action Scheduler Cleanup and Optimization

Updated on 10. 2. 2026

ZiziCache provides optional cleanup for WordPress Action Scheduler tables. It removes old log entries and completed actions to limit database growth. Cleanup runs only when enabled in configuration.

What Gets Deleted

  • actionscheduler_logs — log rows older than db_actionscheduler_logs_days days (default: 1).
  • actionscheduler_actions — actions with status complete, canceled, or failed where last_attempt_gmt is older than db_actionscheduler_actions_days days (default: 7), or is NULL.

Configuration

  • db_actionscheduler_clean — enable or disable Action Scheduler cleanup.
  • db_actionscheduler_logs_days — retention window for logs (days).
  • db_actionscheduler_actions_days — retention window for completed/canceled/failed actions (days).

Settings are stored in ZIZI_CACHE_CONFIG and updated via the admin interface.

Scheduling and Triggers

  • When enabled, cleanup is scheduled via WordPress cron with an interval based on db_actionscheduler_logs_days.
  • Cleanup also runs after standard database cleanup via the action zizi_cache_database_after_options.

There is no separate manual Action Scheduler cleanup action; it runs automatically when enabled.

Optimization After Cleanup

If db_optimize_tables is enabled, ZiziCache runs OPTIMIZE TABLE on actionscheduler_actions and actionscheduler_logs after cleanup. If disabled, no table optimization is performed.

Status Information

The database statistics view exposes Action Scheduler table details when the tables exist:

  • Size of the actions and logs tables (MB)
  • Total log count
  • Action counts by status (complete, pending, canceled, failed)

If Action Scheduler tables are missing, these values are returned as null and no cleanup queries are executed for them.

What are your feelings