Want to disable wp-cron for better WordPress performance?
WordPress uses the wp-cron.php script to handle time-based scheduling tasks.
However, the problem is that this cron job runs every time someone visits your website.
Thus, scheduled tasks are not executed on time for websites with low traffic.
And for websites with massive traffic, the wp-cron script runs too often, which may significantly increase your website load time.
A proper cron job on your server often guarantees better website performance.
This guide will show you how to disable wp-cron and set up a more reliable system cron job.
Frequently Asked Questions
Where are WordPress CRON Jobs Stored?
WordPress cron jobs are stored in the WordPress database inside the wp-options under the option_name cron.
You can option the wp-cron array with: _get_cron_array() or get_option(‘cron’).
Should I Disable WordPress CRON?
Disabling WordPress cron is a matter of preference.
If you can set up a proper system cron on your own, it’s advisable to disable WordPress cron.
It is recommended in the WordPress developer handbook to disable WP-CRON for better website performance.
What You’ll Need Disable WP-CRON in WordPress
To disable WordPress cron, You only need two things;
Your Web host Cpanel: You need access to your web host Cpanel for two reasons;
- To access your File Manager, you’ll need to edit your WordPress configuration file to disable wp-cron.
- If you use an FTP client to access this file, you still need to visit your Cpanel to find your FTP credentials.
An FTP Client (optional): You can use an FTP client to access your website file and edit the wp-config.php file.
An FTP client is third-party software that allows you to edit files on your server.
You’ll connect your server using the FTP credentials you get from your web host.
If you want to avoid installing and setting up an FTP client, you can disable wp-cron from your Cpanel, as we’ll show you in this guide.
How to Disable WP-CRON in WordPress Step by Step
To disable the WordPress cron job, you’ll need to edit your WordPress configuration file.
The wp-config.php file is located inside your website root folder.
To access this folder, we’ll use the Hostinger Cpanel.
So log in to your hosting Cpanel and locate the File Manager.
You should find it under the File section.
Double-click to open. It will take you to your website root folder, public_html.
Inside this folder, locate the wp-config.php file. Right-click on it and select Edit from the options.
Next, you’ll paste the following line of code inside the wp-config.php file above the line that reads /* That’s all, stop editing! Happy publishing. */
define(‘DISABLE_WP_CRON’, true);
Once added, click the Save icon button at the top left.
And that’s it. You’ve successfully disabled wp-cron in WordPress.
WordPress will no longer run the wp-cron.php script when visitors are on your website. You must create your own cron job to ensure that specific scheduled tasks run on your terms.
Setting up Custom Server Cron Job in WordPress
The easiest way to schedule cron jobs from your server is via your web host Cpanel. Almost all popular hosting platforms have a Cpanel.
We’ll continue with Hostinger.
So log in to your hosting account and navigate to Cpanel.
Scroll down until you reach the Advanced section.
You’ll find Cron Jobs under it.
Click Cron Jobs, and the Create a New Cron Job window will open.
The interface may be different depending on your hosting provider.
Leave the Type as PHP.
Next, you need to add the command that will call the wp-cron for your new schedule.
Enter this code in the command to run box.
wget -q -O - https://domain.com/wp-cron.php?doing_wp_cron >/dev/null 2>&1
Make sure you replace domain.com with your website root URL.
Next, you’ll select the frequency of wp-cron calls.
So go to the Common Options dropdown.
You’ll see a list of preset schedules, such as twice per day, once per week, etc.
30 minutes is the standard for most sites.
So, select Twice an hour. After that, click the Save button to apply the changes.
Once done, you’ll see your new cron job added to the list.
And that’s all. You’ve just instructed WordPress to run scheduled tasks every 30 minutes instead of every time people visit your site.
Using a Third-Party Service to Set up Cron Job
If your WordPress hosting provider doesn’t offer a proper cron job or you are uncomfortable setting it up yourself, then you can use a third-party service for your scheduled tasks.
There are many easy-to-use third-party solutions to set up cron jobs.
EasyCron, Cronitior, and SetCronJob are 3 of the best we recommend.
You are good with any of the above services.
They all offer a super intuitive interface and all essential tools to execute all your website cron functions efficiently.
More Helpful WordPress Tutorials
- How to Optimize WordPress for Performance: A slow-loading website sends a go-elsewhere signal to users.? This practical guide will teach you how to boost your website speed and improve WordPress performance.
- How to Disable WordPress Comments: Are you tired of spam comment ad links on your WordPress comment section? The simple fix is to disable comments on your WordPress posts. Follow this guide to see how to do it step by step.
- How to Optimize Images for WordPress: Image optimization is a fundamental aspect of SEO and a great user experience. This guide teaches how to optimize images to improve your WordPress website performance and search ranking.
Wrapping up
The wp-cron is a PHP script that performs WordPress cron jobs on your website.
It automates some core features in WordPress, such as publishing schedule posts, checking for plugin or theme updates, sending email notifications, and creating regular WordPress backups.
While disabling WordPress cron job guarantees better performance, your website will still need to perform specific scheduled tasks.
That’s why you have to create your own cron job.
In this article, we’ve shown how to disable wp-cron and create custom cron jobs from your web host Cpanel.
We’ve also mentioned 3 of the easy-to-use cron job solution you can check out.
You can reach out in the comment section if you have further questions or need more information about cron jobs or other WordPress core functions.