Skip to content

Instantly share code, notes, and snippets.

@autocircled
Created March 29, 2025 05:51
Show Gist options
  • Save autocircled/ad1c460db7badcbb7e1a8d29e3d9e676 to your computer and use it in GitHub Desktop.
Save autocircled/ad1c460db7badcbb7e1a8d29e3d9e676 to your computer and use it in GitHub Desktop.
WordPress custom scheduled event
public static function init() {
add_action( 'init', array( __CLASS__, 'trtrtr') );
add_action( 'weweweaaewa', array( __CLASS__, 'rererere') );
add_filter( 'cron_schedules', array( __CLASS__, 'ac_custom_cron_schedules') );
}
public static function ac_custom_cron_schedules( $schedules ) {
$schedules['every_minute'] = array(
'interval' => 60, // 60 সেকেন্ড = 1 মিনিট
'display' => __( 'Every Minute' ),
);
return $schedules;
}
public static function trtrtr() {
if ( ! wp_next_scheduled( 'weweweaaewa' ) ) {
wp_schedule_event( time(), 'every_minute', 'weweweaaewa' );
}
}
// ইভেন্ট ফাংশন ডিফাইন করা
public static function rererere() {
// এখানে আপনার কার্যকরী কোড লিখুন
error_log( "AC Serial Numbers Cron Ran Successfully!" );
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment