SHARE
TWEET

cron-example-1

selnomeria Jun 14th, 2019 61 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. add_filter( 'cron_schedules', function ( $schedules ) {
  2.             $schedules['one_minute'] = [ 'interval' => 60, 'display'  => esc_html__( 'Every Minute' )];
  3.             return $schedules;
  4.         });
  5.        
  6.         add_action('init', function(){
  7.             if ( ! wp_next_scheduled( $this->prefixed.'cron_hook1' ) ) {
  8.                 wp_schedule_event( time(), 'one_minute', $this->prefixed.'cron_hook1', $this->cron_params );
  9.             }
  10.         });
  11.         add_action( $this->prefixed.'cron_hook1', [$this, 'cron_func'], 10, 1 );
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Top