BotBO CronJob

Home » Snippets » BotBO CronJob
0

Created with:

Cron job Generator

Visibility: 

public

Creator: Beate-Doris Schmid

Customize with WPTurbo AI
X

Add Snippet To Project

New Project
Add To Existing Project
				/**
 * Register and run a custom cron job in WordPress.
 *
 * @return void
 */
function wpturbo_my_custom_cron_job() : void {
	// Your code here.
	// Do something when this function runs...
}
add_action( 'my_custom_cron_job', 'wpturbo_my_custom_cron_job' );

/**
 * Schedule the custom cron job for execution in WordPress.
 *
 * @return void
 */
function botbo_register_botbo_cronjob() : void {
	if ( ! wp_next_scheduled( 'my_custom_cron_job' ) ) {
		wp_schedule_event( time(), 'hourly', 'my_custom_cron_job' );
	}
}
add_action( 'wp', 'botbo_register_botbo_cronjob' );


			

To replace WP-standard CronJobs.

Register an account to save your snippets or go Pro to get more features.