WordPress Business Themes › Forums › Responsive Themes › Coupon Theme › How to Replace WordPress Cron with a Real Cron Job with WordPress
If your system is maxing out memory running CP a possible cause is the wp cron. This little tidbit will help relieve the stress on your server resources. We recently switched to this method here and now all is well.
How to Replace WordPress Cron with a Real Cron Job
Have you ever noticed that your scheduled posts in WordPress are missing? Though WordPress has its own cron feature that dictates the scheduling of your blog’s posts and events, WP-cron is not a literal cron job.
Real Cron Job vs. WP-Cron
Real cron jobs can be controlled by the user, making certain that the items constrained by schedule are run appropriately. Also, for a high-traffic WordPress site, a real cron job can assist with reducing the chances of downtime by lowering the bandwidth on the server, thus using less server resources.
WP-cron is a virtual cron that only works when the page is loaded. WP-cron is first loaded by WordPress when a page is requested on the front or backend of a site at which point WP-cron displays the necessary page to the site visitor. Though convenient, it is known to fail for a variety of reasons, including but not limited to the following:
Conflict of plugins
Use of caching plugins
Large server load
Replace WP-Cron with a Real Cron Job
The best way optimize the efficiency of your WordPress cron jobs is to disable WP-cron and set up a normal cron job through cPanel which will run every hour.
1. Disable wp-cron.php
You can disable WP-cron by modifying the wp-config.php (located in the folder where WordPress is installed). Open the wp-config.php file and add the following line to the top of the page:
2. Set Up a Real Cron
Warning: It is important that you familiarize yourself with how cron jobs work. You need to have a working knowledge of Linux commands before you can use cron jobs effectively.
To set up a real cron job:
Log into your cPanel.
In the Advanced section, click Cron jobs.
Under Add New Cron Job, select the time interval. HostGator recommends that you do not set
the interval lower than 15 minutes.
Set the cron command to the following, replacing yourwebsite.com with your actual domain name:
wget -q -O – http://yourwebsite.com/wp-cron.php?doing_wp_cron >/dev/null 2>&1
The above command tells the Linux server to run wp-cron via wget, which will trigger the
wp-cron.php script to do it’s job on your schedule instead of on each page view. This will lessen
the amount of processes on the server.
Click Add New Cron Job to set the cron.
In order to test out the new cron, simply wait for the elapsed time period for the cron to run. In the event that the cron does not run, please review the steps listed above to ensure that you have completed all steps correctly.
nice share thank you
@Steven. Great info! Thanks a lot.
Yes, it also appears on hostgator, even though they are not my hosting provider. It’s posted all over the net. Just thought it would be useful for others.
Submit your feature requests to our ideas board and it could be included in a future theme update.
or contact our support team