I am trying to trigger a wp cron task via a real (linux) server cron and have followed online instructions to add this to wp-config:

define('DISABLE_WP_CRON', true);

My cron job does this :

wget -O - http://www.mysite.co.uk/wp-cron.php?doing_wp_cron=1

I have proved that the server's cron job is working (i receive the cron emails from the server when I remove > /dev/null 2>&1) but am unsure if my actual scheduled task is running. How can I prove this?

1 Answer 1


I always found that logging cron job execution to a file is very helpful. Otherwise you have no idea if it's working right. Just have your code open a file, write a timestamp, and close.

Something simple like:

 $logfile = $_SERVER['DOCUMENT_ROOT'].'/CRON.txt';
 $handle = fopen($logfile , 'a') or die('Cannot open file:  '.$logfile );
 $data = 'cron task called at '.date('D, d M Y H:i:s',time())."\n";
 fwrite($handle, $data);

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.