[ad name=”postsqrRight”]Recently I have been noticing that this blog has been eating its way through the servers ram like no bodies business, easily using more than 150mb before its automatically killed.
By default the wp-cron.php is run every single time a page is loaded, this includes admin pages. This can lead if you have a busy blog to a lot of cron runs, which simply aren’t needed.
What does the wp-cron do? You might ask, and even if you don’t I will tell you anyway. The wp-cron will do things like scheduled posts and can also include things that plugins want running.
So how we go about this is simple, we will disable the wp-cron from running on every page load, and then add a proper cron job.
First lets disable it:
Simply open wp-config.php and add the follow line.
Note: You need to make sure you use an apostrophe instead of single quotes in the code here, otherwise it will not work!
Second, lets add the cron:
It is probably a good idea to run the cron job every couple of hours, for this we will add something like this.
0 */2 * * *
For the command you simply need to call the wp-cron either using wget OR php -q
php -q /home/cPanel_User/public_html/wp-cron.php
Personally I’d prefer the php -q option as some hosts can have trouble resolving domains on the same server.
If anyone has any questions or comments please leave a comment below and I’ll try to help. 🙂