[ad_1] TL;DR: If you’re using WordPress 6.1+ and aren’t able to schedule any type of job with Action Scheduler, this article explains the problem and a potential fix. Specifically, this seeks to address the following message appearing in WordPress 6.1+: Cron reschedule event error for hook: action_scheduler_run_queue, Error code: invalid_schedule, Error message: Event schedule does not exist., Data: {“schedule”:”every_minute”,”args”:[“WP Cron”],”interval”:60} Resolve the Reschedule Event Error Introducing More Logging Starting in WordPress 6.1, additional logging was added to WordPress core. Specifically, the patch responsible for this includes the following description: Rarely and randomly some of my custom cron events have disappeared. From searching around, I’m not the only one with this issue, and no one else was able to figure out why. I also was unable to debug the issue since wp-cron.php doesn’t log any errors nor have any hooks to try handling them. This patch adds those in. trac Once this patch was introduced, it also resulted in others experiencing issues with cron and cron-related libraries starting from this ticket and then taking place in a specific forum post. When you’re trying to create a schedule but it keeps blowing up. And sure, these tickets are helpful as are the comments and the rest of the discussion in the forum. But there are times when we’re working on a specific task with a specific set of dependencies and need a specific solution. Action Scheduler and Cron Jobs My problem was this: I was trying to to register a job using Action Scheduler and the library wasn’t able to register the schedule because of the aforementioned problem. So the fix was to add this function in my code: /** * Additional logging in WordPress 6.1+ that generates the following * message regarding cron schedules: * * Cron reschedule event error for hook: * action_scheduler_run_queue, * Error code: invalid_schedule, * Error message: Event schedule does not exist., * Data: {“schedule”:”every_minute”,”args”:[“WP Cron”],”interval”:60} * * This function needs to fire prior to loading Action Scheduler as its a * pre-requisite for it to schedule our tasks. * * This filter seeks to manually add the schedule to the list of schedules to * address this bug. */ add_filter(‘cron_schedules’, function ($schedules) { $schedules[‘every_minute’] = [ ‘interval’ => 60, ‘display’ => ‘Every Minute’, ]; return $schedules; }); A few things about this code: I don’t recommend using this as a permanent fix for every case. It’s a specific solution for a generic warning. If your codebase is going to be distributed to wide audience, avoid anonymous functions. If you have control over the environment in which it will return, it may be fine. On the other hand, if you’re using Action Scheduler, WordPress 6.1+, and are trying to register your own jobs and are seeing this message, this will ensure schedules Action Scheduler uses are available. [ad_2] Source link
Continue readingTag Archives: Error
Google Site Kit Plugin Ships Hot Fix for Critical Error That Caused Broken Websites – WP Tavern
[ad_1] Google published an update to its Site Kit plugin for WordPress this afternoon with a hot fix for a critical issue affecting an unknown number of users. Reports of broken websites were popping up on Twitter and in the plugin’s support forum on WordPress.org. Users affected by the issue reported having a critical error on all sites using Site Kit, which forced deactivation of the plugin in recovery mode. In some cases it prevented them from accessing their dashboards. “On Wednesday, August 11, we identified a fatal error in the Site Kit plugin that could be triggered by other plugins or themes using an unprefixed version of Composer,” Google Site Kit Support Lead Bethany Chobanian Lang said in a pinned post on the support forum. Version 1.38.1 contains a hot fix for this issue, since it was critical enough to take down users’ websites. The plugin’s maintainers began investigating the issue less than 24 hours ago but are still not sure which plugins trigger the error due to their usage of Composer. “The reports do not include which specific plugins or themes were causing this, but the error message clearly highlighted the code in Site Kit that was the problem,” Google Developer Relations Engineer Felix Arntz said. “Technically, that problematic code had been in Site Kit since several versions ago (months back), so maybe another plugin/theme recently got updated with new code that exposed the problem.” After looking at popular plugins, Arntz said he hasn’t been able to find one so far that would have triggered the problem. Given Site Kit’s broad usage, other affected sites are bound to turn up once users realize there is a problem. Google launched the plugin in 2019 and has since amassed more than a million active installations. The majority of the plugin’s user base is running older versions, which may or may not be affected by the current issue. WordPress.org shows 35.6% of the plugin’s users are on version 1.38.x. The hot fix is not backported for older releases, but users running Site Kit version 1.38 with background updates enabled should automatically receive the fix. Like this: Like Loading… [ad_2] Source link
Continue reading