1

I did created a cron job for a script in my wordpress site which is using a theme. When the script is called with cron it is not working fine. Some function which are in that script are not recognized, because script not see them and report them as undefined function.

Fatal error: Call to undefined function get_option()

Do i need to include something more, or how to make that script to run normally with cron job ?

4

1 回答 1

1

您可以使用wp_cron(),Wordpress 内置的 cron 功能:http ://codex.wordpress.org/Function_Reference/wp_cron

否则,get_option无法识别的问题可能是因为没有加载 Wordpress 核心。您需要wp-load.php在外部 php 脚本中使用该文件的绝对路径:

require_once("/path/to/wordpress/wp-load.php");

于 2013-05-09T20:16:06.393 回答