The “Scheduled event has failed” error related to action_scheduler_run_queue
in the Site Health tool indicates that a scheduled action in WordPress, typically managed by the Action Scheduler library (often used by plugins like WooCommerce), has not completed successfully. Here’s how to troubleshoot and resolve this issue:
1. Check Scheduled Actions
- Use Action Scheduler Plugin: Install the “Action Scheduler” plugin (or use a similar plugin) to monitor and manage scheduled actions. This tool will help you identify which actions are failing and allow you to manually run or delete them.
2. Review Error Logs
- Enable Debugging: Enable debugging in WordPress by adding the following lines to your
wp-config.php
file:php define('WP_DEBUG', true); define('WP_DEBUG_LOG', true); define('WP_DEBUG_DISPLAY', false);
- Check the Debug Log: After enabling debugging, check the
wp-content/debug.log
file for any error messages related to the failed scheduled actions. This may provide insights into what caused the failure.
3. Check for Conflicting Plugins
- Deactivate Plugins: Try deactivating all plugins and then reactivating them one by one. This can help identify if a particular plugin is causing the issue with the Action Scheduler.
4. Increase PHP Memory Limit
- Adjust Memory Settings: As previously mentioned, increasing the PHP memory limit can resolve issues related to resource allocation. Update your
wp-config.php
:php define('WP_MEMORY_LIMIT', '256M');
5. Check Server Configuration
- Server Resources: Ensure that your hosting environment has adequate resources (CPU, RAM) to handle scheduled tasks. If you’re on shared hosting, consider upgrading to a more robust plan if issues persist.
6. Run WP-Cron Manually
- Trigger WP-Cron: Sometimes, manually triggering WP-Cron can help. You can do this by visiting your site (which will automatically call
wp-cron.php
) or using a plugin like WP Crontrol to run the cron tasks.
7. Update Plugins and Themes
- Keep Everything Updated: Ensure that your WordPress core, themes, and plugins are up to date. Updates often include bug fixes that may resolve scheduling issues.
8. Database Optimization
- Optimize Your Database: A cluttered database can lead to performance issues. Use a plugin like WP-Optimize to clean up your database and optimize its performance.
9. Consult Hosting Provider
- Get Support: If the issue persists after trying the above steps, reach out to your hosting provider for assistance. They may have server-level insights or logs that can help diagnose the problem.
10. Reinstall WordPress Core (if necessary)
- Last Resort: If all else fails, consider reinstalling the WordPress core files. Make sure to back up your site before doing this.
By following these steps, you should be able to address the “Scheduled event has failed” error related to action_scheduler_run_queue
.
Until plugin developers solve this issue, you can get rid of (or delay) the pesky message by using the filter provided below. You can add it directly to your functions.php file or use the plugin, Code Snippets, to accomplish the same.add_filter('action_scheduler_run_schedule', function($arg) { return 86400; });
Hope this helps. Stay safe!
Discover more from Be-smart
Subscribe to get the latest posts sent to your email.