How to Add a Real WordPress Cron Job for a Faster Website
Ravi Chahar
Customer Support Specialist || ???? WordPress Professional || Web Developer || Speaker || Social Media Marketer ??
This is a kind of complicated topic for the beginners. First of all, you should know what are WordPress Cron jobs and how can you add a real WordPress Cron job.
Let me ask you something. Don’t you want a fast loading website? Have you tried so hard to reduce the page loading time of your website?
Just like you, most of the people are struggling to deal with this issue.
In WordPress, there is a wp-cron.php file which was added to handle the scheduled tasks. It gets called every time someone visits your website.
This will check whether any scheduled task is in the queue whenever the page loads. It means, it can impact the CPU usage.
And if anything goes wrong and this file couldn’t work properly, the CPU usage would extend and you will be over the capacity which will finally result in the downtime.
In this tutorial, you will learn to add a real WordPress Cron job for better site handling.
Disable the Default WordPress Cron Job
Before adding a real Cron job, you have to disable the default Cron job.
As mentioned before, the file gets loaded every time someone opens any page of your website. You have to disable this activity.
It can be done by editing the wp-config.php file.
Adding a one line code will do the work. Add this between the PHP tag.
define(‘DISABLE_WP_CRON’, true);
Save the file and from now onwards, WordPress isn’t going to call its Cron job functionality. But you’re not finished yet.
Add a Real WordPress Cron Job from the cPanel
You have to set the real Cron job using the cPanel of your web hosting account. I am sure, it won’t scare. Just follow the steps.
Step 1: – Login and find the “Advanced” section. The interface of the cPanel may be different depending on the web hosting you use.