Disable WordPress cron job
To gain some more speed out of your Classipress installation you should disable WordPress Cron Job.
Why is cron job causing high CPU and SQL usage on my Classipress installation?
Well, it’s like this. After you install your Classipress site or even just WordPress site, you will probable install some additional plugins (in my case around 30). Some of these plugins will have their own cron jobs that they need to run regularly. These jobs are inputted into a WordPress options table.
If your website has a lot of ads, running cron jobs constantly will slow down your website, or you will get a warning from your database host that your website is consuming too much CPU time.
To solve this you need to do a few steps after which you will be able to control website’s cron jobs.
You will do this in three steps:
Step 1: Disable WordPress’s cron control
Step 2: Download a plugin to control your cron jobs
Step 3: Run a script to start cron jobs
Disable WordPress cron jobs
If you have doubts about this, you can skip this step and do it after you go trough all steps.
Open wp-config.php file and input somewhere before end of file.
You can input after define(‘WPLANG’,”);
/** Disable CRON */ define('DISABLE_WP_CRON', true);
Now that you have disabled cron job, no ads will expire, no emails will be sent to users to renew their ads and no checks for updates will be done. But have no fear, WP-Cron Control is here. With this plugin you will be able to run cron jobs when you want them and only you will be able to run them, since there is a secret pass-phrase that is needed to run this script. But you can read all about it on plugin’s official site.
This is the last step that is needed for this to work.
Now, that your cron job is down and you have you have installed WP-Cron Control plugin we need to call this script somehow. Go to Settings of WP-Cron control and there you will see how you can call your script for the crons to be executed.
It is up to you how you will call it. I prefer an online service to do this for two reasons:
– I can be sure it’s working 100%.
– I get an email if something goes wrong even if my site is down and I don’t know about it.
There are a lot of free online cron job services, my favorite is www.easycron.com.
When you decide which one to use, just copy the wget link from WP-Cron Control into your Online Cron Service and set the correct times when you want your cron jobs to be running.
Be avare! Don’t run them too often, or there will be no difference from WordPress’s cron control.
On my website I run cron jobs only twice a day, which is enough for the ads to expire and I don’t care about other updates being run only twice a day.
If you want more control over your cron jobs, take a look at this plugin: WP Crontrol. You will be able to control frequency of every cron job.
If you find any issues with this tutorial, please be so kind and write a comment. I’ll try to help as much as I can.