Add and remove Cron job in WordPress easily!
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
Go to file
Mike iLL Kilmer 9c5e0f82d3
currrent_time() default producing six hour offset here in US (#8)
11 months ago
.gitignore improved the readme 8 years ago
LICENSE missing license 8 years ago
README.md fix example 2 years ago
composer.json improvement 8 years ago
cronplus.php currrent_time() default producing six hour offset here in US (#8) 11 months ago

README.md

CronPlus

License Downloads

Add and remove Cron job in WordPress easily!

Install

composer require wpbp/cronplus:dev-master

composer-php52 supported.

Example

$args = array(
    // to execute at a specific time based on recurrence
    'time' => time(), // not mandatory, will use the current time
    // hourly, daily, twicedaily, weekly, monthly or timestamp for single event
    'recurrence' => 'hourly',
    // schedule (specific interval) or single (at the time specified)
    'schedule' => 'schedule',
    // Name of the Cron job used internally
    'name' => 'cronplusexample',
    // Callback to execute when the cron job is launched
    'cb' => 'cronplus_example',
    // Multisite support disabled by default
    'multisite'=> false,
    // Used on deactivation for register_deactivation_hook to cleanup
    'plugin_root_file'=> '',
    // When the event is scheduled is also executed 
    'run_on_creation'=> false,
    // Args passed to the hook executed during the cron
    'args' => array( get_the_ID() )
);

function cronplus_example( $id ) {
	echo $id;
}

$cronplus = new CronPlus( $args );
// Schedule the event
$cronplus->schedule_event();
// Remove the event by the schedule
$cronplus->clear_schedule_by_hook();
// Jump the scheduled event
$cronplus->unschedule_specific_event();