Visit Eventchamp WordPress theme to create a new events & conference website. Eventchamp WordPress Events Theme

How to Disable WP-Cron and Improve Performance in WordPress

Table of Contents

In this article, we will discuss what WP-Cron is and why you might want to disable it in WordPress. We will also go over the steps for disabling WP-Cron and the potential benefits and drawbacks of doing so.

What is WP-Cron and How Does it Work?

WP-Cron is a built-in WordPress feature that is used to schedule and run automated tasks in WordPress. It is activated each time a user visits a WordPress site, and it checks to see if any scheduled tasks need to be run. If there are tasks that need to be run, WP-Cron will execute them in the background.

Some examples of tasks that WP-Cron handles include:

Hire Us

  • Checking for plugin and theme updates
  • Publishing scheduled posts
  • Sending email notifications
  • Cleaning up old data

While WP-Cron is a useful feature, it can also put a strain on your server’s resources if you have a lot of scheduled tasks or if your website receives a lot of traffic. In these cases, it might be necessary to disable WP-Cron and use a real cron job instead.

Why You Might Want to Disable WP-Cron

There are several reasons why you might want to disable WP-Cron in WordPress:

  1. Improving performance: As mentioned, WP-Cron can put a strain on your server’s resources if you have a lot of scheduled tasks or if your website receives a lot of traffic. Disabling WP-Cron and using a real cron job can help improve the performance of your website.
  2. More accurate scheduling: WP-Cron relies on user visits to trigger the execution of scheduled tasks. This means that the timing of these tasks can be unpredictable and may not run exactly when they are supposed to. By using a real cron job, you can ensure that tasks are run at the exact times that you specify.
  3. Avoiding conflicts with hosting providers: Some hosting providers may have their own cron job schedules that can conflict with WP-Cron. Disabling WP-Cron and using a real cron job can help avoid these conflicts.

Steps to Disable WP-Cron in WordPress

Disabling WP-Cron in WordPress is a fairly simple process. Here are the steps you will need to follow:

  1. Connect to your WordPress site using an FTP client.
  2. Navigate to the root directory of your WordPress installation.
  3. Locate the wp-config.php file and download it to your computer.
  4. Open the wp-config.php file in a text editor.
  5. Add the following line of code to the file:
define('DISABLE_WP_CRON', true);
  1. Save the file and upload it back to your WordPress site, overwriting the original file.
  2. You will now need to set up a real cron job to replace WP-Cron. This can be done through your hosting control panel or by using a tool such as crontab.

Setting up a Real Cron Job

A real cron job is a scheduled task that is executed by the operating system on a web server. It is more reliable and accurate than WP-Cron, as it is not dependent on user visits to trigger the execution of tasks.

To set up a real cron job in WordPress, you will need to follow these steps:

  1. Log in to your hosting control panel.
  2. Navigate to the cron job section of the control panel. This may be located in a section called “Advanced,” “Site Management,” or something similar.
  3. Follow the prompts to create a new cron job. You will need to specify the frequency at which the job should run (e.g. every hour, every day, etc.) and the command that should be executed.
  4. To run the WP-Cron script, you will need to use the following command:
wget -q -O - https://yourdomain.com/wp-cron.php?doing_wp_cron >/dev/null 2>&1
  1. Save the cron job and it will be added to the server’s crontab file.

Alternatively, you can set up a real cron job using the crontab command line utility. To do this, follow these steps:

  1. Open a terminal and enter the following command:
crontab -e
  1. This will open the crontab editor. Add the following line to the file:
wget -q -O - https://yourdomain.com/wp-cron.php?doing_wp_cron >/dev/null 2>&1
  1. Save the file and exit the editor. The cron job will be added to the server’s crontab file.

Benefits and Drawbacks of Disabling WP-Cron

There are both benefits and drawbacks to disabling WP-Cron in WordPress. Some of the benefits include:

  • Improved performance: As mentioned, WP-Cron can put a strain on your server’s resources if you have a lot of scheduled tasks or if your website receives a lot of traffic. Disabling WP-Cron and using a real cron job can help improve the performance of your website.
  • More accurate scheduling: WP-Cron relies on user visits to trigger the execution of scheduled tasks. This means that the timing of these tasks can be unpredictable and may not run exactly when they are supposed to. By using a real cron job, you can ensure that tasks are run at the exact times that you specify.
  • Avoiding conflicts with hosting providers: Some hosting providers may have their own cron job schedules that can conflict with WP-Cron. Disabling WP-Cron and using a real cron job can help avoid these conflicts.

However, there are also some drawbacks to consider when disabling WP-Cron:

  • Manual setup: Disabling WP-Cron requires manual setup and configuration. This can be a time-consuming process, especially if you are not familiar with cron jobs or the command line.
  • Increased complexity: Using a real cron job adds an additional layer of complexity to your WordPress installation. You will need to manage the cron job and ensure that it is running correctly. If something goes wrong with the cron job, it could impact the functionality of your website.
  • Missed tasks: If you do not set up the real cron job correctly, it is possible that some scheduled tasks may not be run. This could lead to missed posts, missed email notifications, or other issues.

How to Schedule Crons in WordPress with Third-Party Solutions

Why Use a Third-Party Solution for Scheduling Crons in WordPress?

While WordPress does have a built-in system for scheduling cron jobs (called WP-Cron), it has some limitations. WP-Cron relies on user visits to trigger the execution of scheduled tasks, which can result in unpredictable timing and may not be suitable for websites with low traffic or infrequent user visits.

For these reasons, many WordPress users choose to disable WP-Cron and schedule cron jobs using a third-party solution. Some popular options for scheduling crons in WordPress include:

  • WP Crontrol: WP Crontrol is a WordPress plugin that allows you to manage and schedule cron jobs from within the WordPress dashboard. It offers a user-friendly interface and is a good option for users who are not comfortable using the command line.
  • EasyCron: EasyCron is a cloud-based cron job service that offers a range of features and pricing options. It is easy to use and allows you to set up cron jobs for your WordPress website without the need for a hosting control panel.

Benefits and Drawbacks of Using Third-Party Solutions for Scheduling Crons in WordPress:

There are several benefits to using a third-party solution for scheduling crons in WordPress:

  • More accurate scheduling: As mentioned, WP-Cron relies on user visits to trigger the execution of scheduled tasks, which can result in unpredictable timing. By using a third-party solution, you can ensure that tasks are run at the exact times that you specify.
  • Better performance: If your website receives a lot of traffic or has a large number of scheduled tasks, WP-Cron can put a strain on your server’s resources. Using a third-party solution can help improve the performance of your website.
  • Easy setup: Many third-party solutions offer user-friendly interfaces and step-by-step instructions, making it easy to set up and manage cron jobs.

However, there are also some drawbacks to consider when using third-party solutions for scheduling crons in WordPress:

  • Additional cost: Some third-party solutions, such as EasyCron, charge a fee for their services. This may not be an issue for larger websites or businesses, but it could be a concern for smaller websites or those on a tight budget.
  • Increased complexity: Using a third-party solution adds an additional layer of complexity to your WordPress installation. You will need to manage the cron job and ensure that it is running correctly. If something goes wrong with the cron job, it could impact the functionality of your website.
  • Dependency on third-party service: When using a third-party solution, you are relying on that service to schedule and run your cron jobs. If the service goes down or experiences issues, it could affect the functionality of your website.

Step-by-Step Instructions for Scheduling Crons in WordPress Using Third-Party Solutions:

In this section, we will provide step-by-step instructions for setting up cron jobs in WordPress using some popular third-party solutions.

Hire Us

Using WP Crontrol:

WP Crontrol is a WordPress plugin that allows you to manage and schedule cron jobs from within the WordPress dashboard. Here is how to set up a cron job using WP Crontrol:

WP Crontrol
  1. Install and activate the WP Crontrol plugin on your WordPress website.
  2. In the WordPress dashboard, go to “Tools” > “Cron Events.”
  3. Click the “Add Cron Event” button.
  4. Enter the name of the cron event and the schedule at which it should run. You can choose from several options, such as hourly, daily, or weekly.
  5. In the “Hook” field, enter the name of the hook that you want to use for the cron event. This should be the name of a WordPress action hook, such as “publish_post” or “wp_footer.”
  6. Click the “Add Cron Event” button to save the cron event.

Using EasyCron:

EasyCron is a cloud-based cron job service that offers a range of features and pricing options. Here is how to set up a cron job using EasyCron:

EasyCron
  1. Go to the EasyCron website and sign up for an account.
  2. Click the “Add New Cron Job” button.
  3. Enter the URL of the script that you want to execute. For example, to run the WP-Cron script, you would use the following URL:
https://yourdomain.com/wp-cron.php?doing_wp_cron
  1. Select the frequency at which you want the cron job to run. You can choose from several options, such as every minute, every hour, or every day.
  2. Click the “Create Cron Job” button to save the cron job.

In summary, disabling WP-Cron in WordPress can offer some performance and accuracy benefits, but it also comes with some added complexity and the potential for missed tasks. Whether or not it is the right choice for your website will depend on your specific needs and circumstances.

  • Alternative solutions: If you are experiencing performance issues with WP-Cron, you may want to consider other solutions before disabling it. For example, you could try optimizing your website for better performance or increasing your server’s resources.
  • Scheduled tasks: It is important to consider the impact of disabling WP-Cron on any scheduled tasks that you have set up on your website. If you rely on WP-Cron to publish scheduled posts or send email notifications, you will need to ensure that these tasks are still being run correctly after disabling WP-Cron.
  • Testing: Before disabling WP-Cron on a live website, it is a good idea to test the process on a staging or development site. This will allow you to see how the changes impact your website and ensure that everything is working correctly before making the changes live.

In conclusion, disabling WP-Cron in WordPress can offer some performance and accuracy benefits, but it also comes with added complexity and the potential for missed tasks. Whether or not it is the right choice for your website will depend on your specific needs and circumstances. Before making the decision to disable WP-Cron, it is important to carefully consider the potential impact on your website and any scheduled tasks, and to thoroughly test the changes on a staging or development site before implementing them on a live website.

Picture of Katerina Valeria
Katerina Valeria
Hi there! My name is Catherine and I am a professional content creator with a focus on WordPress. I write blog articles for Gloria Themes, sharing my knowledge and expertise on all things related to this popular website platform.

Subscribe to Our Newsletter for Updates, Tips, and Offers

Facebook
Twitter
LinkedIn
Pinterest
WhatsApp

Hand-Picked Related Articles

If you’re looking for helpful tips and tricks on improve your WordPress website or improving your web design skills, be sure to check out our related articles for valuable insights and resources.