- Case Studies
- Company Journey
- Digital Marketing
- Product Updates
- Web Hosting
- WordPress Hosting
- WordPress Plugins
- WordPress Tips and Tricks
How Do I Disable WP-Cron In WordPress?
by Ben Gabler on
“To WP-Cron or not WP-Cron, that is the question.” “I WP-Cron, therefore I exist.” “Everything you always wanted to know about WP-Cron but were afraid to ask.” We had so many spoof titles in mind while brainstorming for this semi-exhaustive guide. All joking aside, cron jobs are an important part of why computers are valuable – processing. Thinking for us. Doing for us.
One of the best jobs for a computer is scheduling and executing tasks. Even better, is when a computer will do tasks while we’re sleeping, or working on something else. Likely, it’s both. As good as WP-Cron is, it has downsides. There are use-cases that encourage you to disable WP-Cron in WordPress – especially if page load times matter (they do). But first, what is WP-Cron?
What is WP-Cron?
Cron is short for chronological. Think of getting things done on time. If you’re familiar with Unix-like systems, you’ll know their cron utility. Any software that talks to a server is likely to have some kind of utility to schedule tasks. WordPress also has a cron utility called WP-Cron only it uses intervals instead of pure time.
“WP-Cron is how WordPress handles scheduling time-based tasks in WordPress. Several WordPress core features, such as checking for updates and publishing scheduled post, utilize WP-Cron.”WordPress Codex
What Does WP-Cron Do?
WP-Cron uses hooks to call a function. (How’s that for an unclear answer?) WordPress Core uses WP-cron to check for updates, for example. WordPress plugins may use WP-Cron to send donor receipts, start a scheduled backup, or any number of tasks related to the functionality of that particular plugin.
“WordPress default cron is not reliable and it depends on your site traffic. It’s always better to use server side CRON handler.” Fluent CRM
How Often Does WP-Cron Run?
WP-Cron runs at the scheduled time when a page loads. So, if a page doesn’t load at the time of the scheduled cron job, then there could be errors. So the answer to the question is “it depends.” More succinctly, WP-Cron jobs run at page loads. The WordPress Codex says that WP-Cron will run “eventually.” (Not very reassuring).
“With WP-Cron, all scheduled tasks are put into a queue and will run at the next opportunity (meaning the next page load). So while you can’t be 100% sure when your task will run, you can be 100% sure that it will run eventually.” WordPress Codex
How often does WP-Cron run? As often as a page loads.
Is WP-Cron Enabled by Default?
Yes, WP-Cron is enabled by default. It is part of WordPress Core. For example, this is how WordPress checks for updates and publishes blog posts that are scheduled.
“By default the WP Cron is enabled because there are WordPress features that rely on to execute scheduled jobs.”SmackCoders.com
How Do I Disable WP-Cron?
Before we talk about how you disable WP-Cron we should talk bout why you should disable WP-Cron. If your site is on shared hosting, for example, you would’t want to take up all of the server resources (processing power, etc.) on countless cron jobs run by various plugins. This is another reason why plugin bloat can be a problem. Not only would you be a poor internet citizen on a shared server, but your site would run really slow. WP-Cron runs on page load. And that Time to First Byte is a huge indicator of Core Web Vitals.
You disable WP-Cron in by adding the follow code to the top of your wp-config.php file:
Now, since WP-Cron is disabled in your wp-config.php file your site will no longer execute wp-cron on requests, ultimately improving your site’s TTFB.
What Happens If I Disable WP-Cron?
If you disable WP-Cron posts may not publish, plugins and core may not update, as well as a number of things. However, if WP-Cron is disabled, it’s most likely replaced with “a proper cron running on the server instead” as Better Notifications for WP mentions.
How do I enable a System Cron?
Now that WP-Cron is disabled via our wp-config file, we need to have wp-cron execute in order for some very important tasks to run.
Did you know Rocket.net staff can do this for you? Our team is available 24 hours a day, 7 days a week and has an average response time of just 41 seconds.Get Started
Whether you’re using cPanel or a custom control panel, your hosting should support creating cron jobs. You may need to contact your host to have them create it for you, but ultimately you’ll want to have the following cron created so your wp-cron executes every 15 minutes at minimum:
*/15 * * * * wget -q -O - https://yourdomain.com/wp-cron.php?doing_wp_cron >/dev/null 2>&1
The >/dev/null 2>&1 part of the line above will disable email notifications every time the cronjob runs.
Are There Any WP-Cron Vulnerability Problems?
Any code can be vulnerable to security attacks, even WP-Cron. This is one of the reasons why we’ve implemented Cloudflare Enterprise on the Rocket Platform – our customers can choose to use Cron Triggerd Workes instead. More importantly, however, WP-Cron can be its own worst enemy. It’s an internal threat.
“It becomes a rudimentary DDoS attack against yourself. This is because the cron is being executed multiple times a minute using an HTTP request.”The CPanel Guy
How Do I Check to See if WP-Cron is Working?
You can check to see if WP-Cron is working by installing a plugin like WP Control, as WPBeginner recommends. If your scheduled blog posts aren’t publishing on time, this is an indicator that WP-Cron (or an alternative) isn’t working.
Will My Website Be Faster if I Disable WP-Cron?
You can make your site faster by disabling WP-Cron and moving to a server-side solution. This is especially true when your traffic scales – quickly. Since WP-Cron is triggered on a page load, the more a page is loaded the more WP-Cron jobs are executed. Essentially, that’s a greedy beast. “Feed me, Seymour!”
Talk Is Cheap. Let Rocket Show You What The Fastest WordPress Hosting REALLY Means!
Saving site performance, your agency’s time, and money? Yes. The Rocket Platform has built-in features that eliminate your need for otherwise paid versions of security, image optimization, CDN, and JS content loader plugins. They are features built into your new favorite platform (the product formerly known as Managed WordPress Hosting).
Let’s talk about how we can migrate your site to Rocket.net, the fastest WordPress hosting available anywhere. Launch your Mission today!