2014-07-21 34 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可能是这样的问题更好的地方。