php - cron job on wordpress site is generating fatal error -


i did created cron job script in wordpress site using theme. when script called cron not working fine. function in script not recognized, because script not see them , report them undefined function.

fatal error: call undefined function get_option() 

do need include more, or how make script run cron job ?

you can use wp_cron(), wordpress's built in cron function: http://codex.wordpress.org/function_reference/wp_cron

otherwise, issue get_option not being recognized because wordpress core not loaded. need require wp-load.php in external php script absolute path file:

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


Comments

Popular posts from this blog

linux - xterm copying to CLIPBOARD using copy-selection causes automatic updating of CLIPBOARD upon mouse selection -

qt - Errors in generated MOC files for QT5 from cmake -