Stars: 185
Forks: 36
Pull Requests: 39
Issues: 64
Watchers: 7
Last Updated: 2023-09-06 21:49:36
WP Crontrol lets you view and control what's happening in the WP-Cron system.
License: GNU General Public License v2.0
Languages: PHP, JavaScript, CSS, Shell
Contributors: johnbillion, scompt
Tags: cron, wp-cron, crontrol, debug
Requires at least: 4.4
Tested up to: 6.3
Stable tag: 1.15.3
Requires PHP: 7.4
Donate link: https://github.com/sponsors/johnbillion
WP Crontrol enables you to view and control what's happening in the WP-Cron system.
WP Crontrol enables you to view and control what's happening in the WP-Cron system. From the admin screens you can:
WP Crontrol is aware of timezones, will alert you to events that have no actions or that have missed their schedule, and will show you a helpful warning message if it detects any problems with your cron system.
Tools → Cron Events
menu to manage cron events.Settings → Cron Schedules
menu to manage cron schedules.I maintain several other plugins for developers. Check them out:
WP Crontrol is private by default and always will be. It does not send data to any third party, nor does it include any third party resources.
WP Crontrol's full privacy statement can be found here.
WP Crontrol aims to be fully accessible to all of its users. It implements best practices for web accessibility, outputs semantic and structured markup, adheres to the default styles and accessibility guidelines of WordPress, uses the accessibility APIs provided by WordPress and web browsers where appropriate, and is fully accessible via keyboard and via mobile devices.
WP Crontrol should adhere to Web Content Accessibility Guidelines (WCAG) 2.0 at level AA when used with a recent version of WordPress where its admin area itself adheres to these guidelines. If you've experienced or identified an accessibility issue in WP Crontrol, please open a thread in the WP Crontrol plugin support forum and I'll address it swiftly.
Yes, it's actively tested and working up to PHP 8.2.
You can read all about problems spawning WP-Cron on the WP Crontrol wiki.
You can read all about cron events that miss their schedule on the WP Crontrol wiki.
If the event is added by a plugin then the plugin most likely rescheduled the event as soon as it saw that the event was missing. To get around this you can instead use the "Pause this hook" action which means it'll remain in place but won't perform any action when it runs.
This depends entirely on the event. You can use your favourite search engine to search for the event name in order to find out which plugin it belongs to, and then decide whether or not to delete it.
If the event shows "None" as its action then it's usually safe to delete. Please see the other FAQs for more information about events with no action.
The WordPress core software uses cron events for some of its functionality and removing these events is not possible because WordPress would immediately reschedule them if you did delete them. For this reason, WP Crontrol doesn't let you delete these persistent events from WordPress core in the first place.
If you don't want these events to run, you can use the "Pause this hook" action instead.
Pausing an event will disable all actions attached to the event's hook. The event itself will remain in place and will run according to its schedule, but all actions attached to its hook will be disabled. This renders the event inoperative but keeps it scheduled so as to remain fully compatible with events which would otherwise get automatically rescheduled when they're missing.
As pausing an event actually pauses its hook, all events that use the same hook will be paused or resumed when pausing and resuming an event. This is much more useful and reliable than pausing individual events separately.
Resuming an event re-enables all actions attached to the event's hook. All events that use the same hook will be resumed.
This means the cron event is scheduled to run at the specified time but there is no corresponding functionality that will be triggered when the event runs, therefore the event is useless.
This is often caused by plugins that don't clean up their cron events when you deactivate them. You can use your favourite search engine to search for the event name in order to find out which plugin it belongs to, and then decide whether or not to delete it.
You can change the time and recurrence of a cron event by clicking the "Edit" link next to the event.
From the Tools → Cron Events → Add New screen, create a PHP cron event that includes PHP that fetches the URL using the WordPress HTTP API. For example:
wp_remote_get( 'http://example.com' );
You can read all about the features and security of PHP cron events on the WP Crontrol wiki.
You can read all about problems with editing cron events on the WP Crontrol wiki.
Yes, a CSV file of the event list can be exported and downloaded via the "Export" button on the cron event listing screen. This file can be opened in any spreadsheet application.
Not yet, but I hope to add this functionality soon.
Yes. The excellent Simple History plugin has built-in support for logging actions performed via WP Crontrol.
Cron schedules are used by WordPress and plugins for scheduling events to be executed at regular intervals. Intervals must be provided by the WordPress core or a plugin in order to be used. As an example, many backup plugins provide support for periodic backups. In order to do a weekly backup, a weekly cron schedule must be entered into WP Crontrol first and then a backup plugin can take advantage of it as an interval.
There are two steps to getting a functioning cron event that executes regularly. The first step is telling WordPress about the hook. This is the part that WP Crontrol was created to provide. The second step is calling a function when your hook is executed.
Step One: Adding the hook
In the Tools → Cron Events admin panel, click on "Add New" and enter the details of the hook. You're best off using a hook name that conforms to normal PHP variable naming conventions. The event schedule is how often your hook will be executed. If you don't see a good interval, then add one in the Settings → Cron Schedules admin panel.
Step Two: Writing the function
This part takes place in PHP code (for example, in the functions.php
file from your theme). To execute your hook, WordPress runs an action. For this reason, we need to tell WordPress which function to execute when this action is run. The following line accomplishes that:
add_action( 'my_hookname', 'my_function' );
The next step is to write your function. Here's a simple example:
function my_function() {
wp_mail( '[email protected]', 'WP Crontrol', 'WP Crontrol rocks!' );
}
In the Tools → Cron Events admin panel, click on "Add New". In the form that appears, select "PHP Cron Event" and enter the schedule and next run time. The event schedule is how often your event will be executed. If you don't see a good interval, then add one in the Settings → Cron Schedules admin panel. In the "Hook code" area, enter the PHP code that should be run when your cron event is executed. You don't need to provide the PHP opening tag (<?php
).
You can read all about the features and security of PHP cron events on the WP Crontrol wiki.
Only users with the manage_options
capability can manage cron events and schedules. By default, only Administrators have this capability.
Only users with the edit_files
capability can manage PHP cron events. This means if a user cannot edit files via the WordPress admin area (i.e. through the Plugin Editor or Theme Editor) then they also cannot add, edit, or delete a PHP cron event in WP Crontrol. By default only Administrators have this capability, and with Multisite enabled only Super Admins have this capability.
If file editing has been disabled via the DISALLOW_FILE_MODS
or DISALLOW_FILE_EDIT
configuration constants then no user will have the edit_files
capability, which means adding, editing, or deleting a PHP cron event will not be permitted.
Therefore, the user access level required to execute arbitrary PHP code does not change with WP Crontrol activated.
You can read all about the features and security of PHP cron events on the WP Crontrol wiki.
The cron commands which were previously included in WP Crontrol are now part of WP-CLI itself. See wp help cron
for more info.
You can read all about what happens when you deactivate the plugin on the WP Crontrol wiki.
The photo was taken by Michael Pardo and is in the public domain.