Forums

wp_schedule_event (1 post)

  1. andriuss
    Member
    Posted 5 months ago #

    Hello i want that my cron would call function every day at 2 o`clock am. Do I write correct ? Or something wrong? because its not working..

    register_activation_hook(__FILE__, 'my_activation');
    add_action('my_hourly_event', 'do_this_hourly');
    
    function my_activation() {
    	wp_schedule_event(strtotime(date('Y-m-d 00:02:00')), 'daily', 'my_hourly_event');
    }
    
    function do_this_hourly() {
    	update_option('makeoption', date('Y-m-d H:i'));
    }

    [No bumping, thank you.]

Reply

You must log in to post.

About this Topic