In the dog-eat-dog world that is the modern internet, speed and security matter. In this post we look at how disabling and replacing wp-cron with a real cron job can dramatically improve the speed and security of your WordPress site in just a few minutes.
One of the regular tasks we do for our Managed WordPress customers is to disable wp-cron and replace it with a real cron job for them. This helps improve the speed, security and stability of their WordPress sites.
What is WordPress wp-cron?
WordPress built-in wp-cron runs all the scheduled events your WordPress site uses day-to-day. Tasks like publishing scheduled posts, checking for theme and plugin updates, sending notifications and much more are all handled by WP-Cron. Without WP-Cron your site would seem pretty lifeless.
WordPress runs wp-cron run every time a visitor opens a page on your website and it will check and see if any scheduled events need to be run. The benefit of running wp-cron this way is it adds flexibility and ensures WordPress can run on any web hosting environment without extra configuration.
However, there are disadvantages:
1. It relies on visitors to your site to run.
Wp-cron is only run when a visitor opens a page on your site. If no-one is on your website (such as overnight) it does not run. This means any scheduled events are delayed. The best example is if you’ve scheduled a post to be published at a specific time. If no-one visits your website at the time it’s due, your post won’t be published and you’ll see a ‘delayed’ message in your WordPress dashboard.
2. wp-cron is run by every visitor to your site and runs every time they open a page.
Say you have 30 visitors on your WordPress site in the same second. Every one of those 30 visitors is going cause your WordPress website to run wp-cron 30 separate times. If 15 of your visitors click a link on your website in the next second, wp-cron will be run again 15 times. And it’s not just real people who can cause it to run. If Googlebot or Bingbot crawl your site they are treated as if they are real visitors.
This is inefficient, causes your website to run slower the more visitors you have and makes you an easy target for Denial of Service (DoS) attacks.
The solution: Setup a real cron job for WordPress
Fortunately, the solution is really simple. Disabling wp-cron and setting up a separate cron job on your Ecenica web hosting package solves all the disadvantages and leaves you with all the benefits.
Our team of WordPress Experts have posted step-by-step instructions on our knowledge base article How to Replace the WordPress Cron with a cPanel Cron Job
About Ecenica Managed WordPress Hosting
Ecenica is a UK-based web host specialising in optimised Managed WordPress Hosting. We’ve been hosting websites since 2004 and have a solid reputation for easy, secure and fast web hosting backed by amazing customer service.
If you’re looking for a reliable web host to help you manage your WordPress website, check out our Managed WordPress Hosting services!
This content was originally published here.