PHP code example of arraypress / wp-register-cron

1. Go to this page and download the library: Download arraypress/wp-register-cron library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

arraypress / wp-register-cron example snippets


add_action( 'init', function () {
	register_cron_job( 'myplugin_sync', [
		'schedule' => 'daily',
		'callback' => 'myplugin_run_sync',
	] );
} );

register_cron_schedule(
	'every_five_minutes',
	5 * MINUTE_IN_SECONDS,
	__( 'Every five minutes', 'my-plugin' )
);

unregister_cron_jobs();