2014-07-21 33 views
0

我在每天00:01 AM設置了wp_schedule_event。在這裏我的代碼:我想設置wp_schedule_event特定時間

<?php 

    add_action('wp', 'cron_hookup'); 
    /** 
    * On an early action hook, check if the hook is scheduled - if not, schedule it. 
    */ 
    function cron_hookup() { 
     if (! wp_next_scheduled('cron_funct')) { 
      wp_schedule_event(time(), 'hourly', 'cron_funct'); 
     } 
    } 

    add_action('cron_funct', 'cron_order'); 

?> 

回答

0

它看起來像你去過的Codex讓你的代碼,但也許它只是不夠清晰那裏。所以我會看看我能做些什麼。

add_action('wp', 'cron_hookup'); 
function cron_hookup() { 
    if (! wp_next_scheduled('prefix_hourly_event')) { 
     wp_schedule_event(time(), 'daily', 'cron_funct'); 
    } 
} 
/** This code will setup the cron job to run daily */ 


add_action('cron_funct', 'prefix_do_this_daily'); 
function prefix_do_this_daily() { 
    // This is the code that will be done executed every day. 
} 

此外,http://wordpress.stackexchange.com可能是這樣的問題更好的地方。