【发布时间】:2018-12-11 02:53:44
【问题描述】:
谁能帮我解决这个问题。我是php编码的新手
我需要通过 wordpress function.php 每天两次运行这个 URL https://sample.com/wp-admin/admin-ajax.php?action=run_scrapper
我使用了这些代码,但它不起作用。
register_activation_hook(__FILE__, 'my_schedule');
add_action('execute_scrapper', 'do_this_daily');
function my_schedule() {
$timestamp = wp_schedule_event($timestamp, 'twicedaily', 'execute_scrapper');
}
function do_this_daily() {
wp_remote_get( 'https://sample.com/wp-admin/admin-ajax.php?action=run_scrapper', $args);
}
【问题讨论】:
-
尝试比它不工作更具体,就像你得到任何错误或现在的行为是什么
标签: php wordpress triggers cron