Download the PHP package arraypress/wp-register-cron without Composer
On this page you can find all versions of the php package arraypress/wp-register-cron. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download arraypress/wp-register-cron
More information about arraypress/wp-register-cron
Files in arraypress/wp-register-cron
Package wp-register-cron
Short Description Declarative WordPress cron jobs and custom schedules, cleaned up properly on uninstall.
License GPL-2.0-or-later
Informations about the package wp-register-cron
Register Cron
Declare a plugin's scheduled jobs, and have them cleaned up properly when it is removed.
What it does
Scheduling in WordPress is two calls that must not disagree:
wp_next_scheduled() before wp_schedule_event(), on the right hook, with
the right arguments — and then the same arguments again at uninstall or the
job is left behind forever, firing for a plugin that is no longer there.
This is the declaration instead. You say what should run and how often; the scheduling, the duplicate check and the uninstall are handled.
Features
- Declare a job once, instead of guarding
wp_schedule_event()by hand - Add a schedule WordPress does not have, like every five minutes
- Pass arguments, so the same hook can run per site, feed or account
- Unschedule everything the plugin registered, in one call at uninstall
- Ask when a job runs next, to show in an admin screen
- Change a schedule and have the existing event rescheduled, not duplicated
Installation
Quick start
A schedule of your own, if hourly, twicedaily and daily are not enough:
And at uninstall, the part that usually gets forgotten:
What it does not do
WordPress cron runs on traffic, not on time — a quiet site runs a "daily" job
late, and a job that must be punctual needs a real system cron hitting
wp-cron.php. Nothing here changes that.
Requirements
- PHP 8.3 or later
- WordPress 7.1 or later
License
GPL-2.0-or-later