Reputation: 1533
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 ?
Upvotes: 1
Views: 1069
Reputation: 10190
You can use wp_cron()
, Wordpress's built in cron function: http://codex.wordpress.org/Function_Reference/wp_cron
Otherwise, the issue with get_option
not being recognized is probably because Wordpress core is not loaded. You need to require wp-load.php
in your external php script with the absolute path to that file:
require_once("/path/to/wordpress/wp-load.php");
Upvotes: 1