How do I disable WordPress Cron Jobs to increase my website speed?

Let’s talk about WordPress and how to combat the slow website speeds that come with it.

Sure, plugins, JavaScript, heavy theme files, and other usability issues play a factor. But we aren’t going to go there today; today, we will talk about the built-in WordPress Cron Jobs, discuss what they do, and then show you how to disable them by using just a bit of technical intervention.

What is a WordPress Cron Job?

WordPress Cron Jobs are triggered events that process behind the scenes that help WordPress look for updates, check plugins, publish scheduled posts, etc.

Do you need them to run your site? Yes, I would say so, but the “everything in moderation” saying rings home in this case. You can utilize these scheduled events via your hosting service in a much more controlled and modest way.

Why are the built-in WordPress Cron Jobs a bad thing?

They suck the life from your website. When a visitor lands on your website or views a page, this triggers WordPress to run a Cron.

For example, you may have decided to install a backup plugin to back up your website and data automatically; let’s say you set this plugin to run once a day to backup your entire website. More often than not, this setting alone would likely reduce your website speed performance to a crawl during the 20 to 30 minute period while the website is backing up. Over time, plugins, applied settings, and functionality added to your WordPress website begin to stack up. You have Cron processes running for the majority of the day, leaving your website performance to suffer.

How to fix it?

Simple, what we want to do here is disable the auto Cron Jobs and then apply a setting via your website hosting service to allow the WordPress Cron Jobs to run once per day, preferably in the middle of the night.

  • Step 1 – Disabling WordPress Cron Jobs

Open your wp-config.php file and add the below code to your file:

define('DISABLE_WP_CRON', true); 
  • Step 2 – Add a Manual Cron Job Via Your Website Hosting

If cPanel powers your website hosting service, log in and browse to the Cron Jobs area, then follow the prompts setting the specific frequency and time you want your Cron Jobs to run.

Add the command below:

cd /home/INSERTUSERNAME/public_html; php -q wp-cron.php 

Where you see INSERTUSERNAME you will want to use the username utilized to login to your cPanel.


Posted

in

by


  • The Power of Rate Limiting: Enhancing Website Traffic and Performance

    In the fast-paced digital landscape, where website traffic and user interactions are at an all-time high, ensuring optimal performance and security has become a critical concern for website administrators. One effective technique that can significantly improve both website traffic management and performance is rate limiting. Rate limiting is a method that controls the number of…

  • How do I Remove the “Save my name” Checkbox In WordPress?

    In WordPress, when users leave comments on your blog posts, they are often asked to provide their name, email address, and website. By default, WordPress includes a checkbox labeled “Save my name, email, and website in this browser for the next time I comment.” This checkbox allows users to have their information saved in cookies,…

  • How do you force SSL and fix mixed content with HTACCESS?

    So, you have a shiny new SSL certificate for your website, and now you need to force SSL, but you keep getting mixed content errors. This simple guide will consist of two parts and should get you up and running with a “green lock” in no time. Step 1 — You Need To Modify Your…

  • How do I reset all form fields using pure JavaScript?

    It doesn’t matter why you might want to add a reset form button for your users. It could be that the form has conditional logic, is super long, complex, or that it has form fields that are prone to user error. We will look at a straightforward way to add a form button to reset…

  • How do I create a simple news ticker using HTML and CSS?

    Alright, so you need some text, links, or images to scroll across your website from left to right. Some folks call this a “news ticker”, some call it a “text scroller” — we will stick with news ticker for the sake of keeping our references simple. Sure, you can make this happen with JavaScript but why complicate…

  • How do I make a textarea form field match an input form field?

    Have you ever wondered why the default font for a form textarea field is different when using a placeholder? The default fonts for all web forms are usually determined by the browser used, and technically, it is up to us to define what fonts or styles to display via our CSS. Here is how you…