WordPress:Function Reference/wp schedule event
来自站长百科
描述[ ]
确定WordPress actions core 在你规定的特别的时间间隔内执行hook的时间。如果预定的时间已经过去,有人访问你的站点的时候,action就会引发。请看看插件API上的hooks列表。
用法[ ]
%%% <?php wp_schedule_event(time(), 'hourly', 'my_schedule_hook'); ?> %%%
参数[ ]
例子[ ]
规定每隔一小时的操作[ ]
在插件中规定每隔一小时的操作,调用激活的wp_schedule_event(否则,你需要结束许多预定的操作!)
register_activation_hook(__FILE__, 'my_activation'); add_action('my_hourly_event', 'do_this_hourly'); function my_activation() { wp_schedule_event(time(), 'hourly', 'my_hourly_event'); } function do_this_hourly() { // do something every hour }
深入阅读[ ]
关于完整的函数的列表,请看看[1]