What Is Cron
Cron is a UNIX scheduling tool. It automatically runs jobs at the given time. Normally, it is controlled through a file and/or commanline tool known as crontab. It is unlikely that these would be directly accessible on a hosting server, but many provide a GUI interface that allows a site admin to setup a local crontab to run for their site.
Why Turn It Off
If you have worked with cron or some other scheduler in the past, you probably realize that they create a thread or process that simply goes to sleep for a specific number of clock ticks. After the specified period of time, the thread wakes up and checks the queue for any pending jobs. If there are any, it will process the queue. Then, it will once again go back to sleep.
wp-cron works nothing like that, however. The PHP files on a WordPress are processed whenever a user hits the site. When that occurs, WordPress will go through its configuration files to see what processes and files to load and then which and how to present them to the user.
Notice that this is done for every user! Therefore, WordPress will run the
wp-cron.php file every time a user hits the site! It seems that this constant loading can put quite a bit of load on some servers.
You can appreciate why some hosting services will choose to disable the ability for this function to run. You can also appreciate why there are some caching plugins out there that reduce server load by creating cached HTML files that are ready to serve up rather than recreate them every time.
- Set a cron job via your cPanel/Plesk to directly run
wp-cron.phpfile in root directory in every minute,every hours,every day, every week,every month, every year.
- Add below code to
wp-config.phpin your root directory.
It should work now, but if it times out, you need to edit the cron.php file in the wp-includes directory; Then change the timeout value from 0.01 to 1.00 for
wp_remote_post.12345//Original: CodingRepo.comwp_remote_post( $cron_url, array(‘timeout’ => <strong><font size="3">0.01</font></strong>, ‘blocking’ => false, ‘sslverify’ => apply_filters(‘https_local_ssl_verify’, true)) );//New: CodingRepo.comwp_remote_post( $cron_url, array(‘timeout’ => <strong><font size="3">1.00</font></strong>, ‘blocking’ => false, ‘sslverify’ => apply_filters(‘https_local_ssl_verify’, true)) );
Save the file and test.
- If you have used any plugin to manage this issue (like WP Missed Schedule), please deactivate it.
>>>>>>>>>>>> What I meant is it (your plugin) will check for the ‘Missed schedule’ posts in every 5 minutes, right?. So in some cases it may causes a delay(around 5 mins) in publishing the post than the actual time of publishing. Please ignore it.