‘wp_site_health_scheduled_check’ Causes Failure Of Other Scripts

First, turn on WP_DEBUG to get a log of the issue. In your wp-config.php you can add something like: define(‘WP_DEBUG’, true); //record all the errors define(‘WP_DEBUG_LOG’,__DIR__.’/wp-content/.wp-debug.log’); //you may want to move this to a more secure location (outside of the web root) define(‘WP_DEBUG_DISPLAY’, false); //don’t show errors on the front end Second, depending on your … Read more

WP CRON Fails At 13:00 Every Day

After further troubleshooting today, and with outstanding support from SiteGround, I have found the root cause. Turns out that every time termly_account_update wp-cron action ran (scheduled every 24 hours), it would crash the wp-cron processes, causing all other due now wp-cron actions to fail, including my my_heartbeat action. termly_account_update is a wp-cron job associated with … Read more

Cronjob function not executed – negative seconds

I’ve managed to fix it! The problem was calling the wrong add_action. I had: // Schedule Cron Job Event function custom_cron_job() { if ( ! wp_next_scheduled( ‘XML_import’ ) ) { wp_schedule_event( time(), ‘hourly’, ‘XML_import’ ); } } add_action( ‘wp’, ‘custom_cron_job’ ); But it must be: // Schedule Cron Job Event if (! wp_next_scheduled( ‘xml’ ) … Read more

wp_mail sending only once inside foreach loop

Sometimes the mail port can get clogged up, so I usually add a brief sleep(10) in the for-loop. The 10 seconds is arbitrary, but it works for my purposes. foreach($entries as $key=>$entry){ $email = array( ‘[email protected]’ ); $subject = “Documents Requested”; $headers = array(‘Content-Type: text/html; charset=UTF-8’); $message = getDMVemailMessage($entries[$key][‘id’]); $sent = sendDMVNotifyEmail($email, $subject, $message, $headers); … Read more

Cron event running more than once if triggered from WP Crontrol

I think I solved this issue. The reason seems to be that I had the following cron related constants set in my wp-config.php file: define( ‘DISABLE_WP_CRON’, false ); define( ‘ALTERNATE_WP_CRON’, true ); Since I am using a docker container here, I added ALTERNATE_WP_CRON and when using this we also need to set DISABLE_WP_CRON to true, … Read more