WordPress has an exclusive scheduling mechanism called WP-Cron. This mechanism allows site owners to manage scheduled activities like running automated backups, sending triggered emails, publishing blog posts at a particular time, and more.

WP-cron is helpful for multiple websites, but it has a few downsides. For example, it may not execute scheduled tasks like publishing a blog post at a specific time or date. To overcome this problem, you must know how to set up proper cron jobs.

These jobs do not depend on site visitors and run on a given schedule. It means that scheduled tasks are conducted on time and regularly.

This blog post will discuss how to disable wp-cron in WordPress and methods for setting up proper cron jobs.

What Do You Mean by WP-Cron in WordPress?

What Do You Mean by WP-Cron in WordPress_

On the WordPress website, Cron jobs help schedule activities at specific dates, times, or intervals. Scheduled posts are one prime example of a cron job. Other examples include checking for updates and running a backup plugin on a predefined schedule.

WP-Cron manages cron jobs in WordPress specifically and stimulates the system’s cron. It mainly handles time-sensitive tasks like sending email notifications, carrying out scheduled backups, performing scheduled maintenance activities, and more.

Why Should We Disable WP-Cron in WordPress?

Do you know that WordPress sites heavily rely on a built-in scheduling system? Yes, it is true. This built-in scheduling system is called wp-cron. Site owners should not undermine its importance, as it is responsible for executing various crucial tasks, such as automatically creating regular backups, publishing scheduled posts, sending emails, checking for updates, etc.

However, WordPress only checks scheduled jobs when a user lands on the website. This works in favor of most sites. Sometimes, it does not work well for smaller sites. For instance, the scheduled posts will not be published on time if a site does not have high traffic.

That’s because wp-cron will not run frequently as needed. As a result, you may face the missed schedule post error in WordPress.

On the other hand, if a website has high traffic, wp-cron will be examined regularly, hampering the site’s performance. In this case, the server must process the cron check and the page request. Therefore, you must set up a proper cron job to overcome all scheduled action issues.

Ideally, a web hosting server’s operating system performs the real cron job. This means WordPress does not perform this task.

How Can We Disable WP-Cron in WordPress?

Fortunately, deactivating wp-cron in WordPress is not as cumbersome as you think. To deactivate or disable wp-cron in WordPress, edit the core WordPress configuration file, wp-config.php. This configuration file usually exists in the WordPress site’s root folder.

To deactivate or disable wp-cron in WordPress, follow the steps below:

  • Connect to your server utilizing an FTP client.
  • You must right-click the wp-config.php file and choose edit.
  • You should add the code into the wp-config.php file before the line saying, ‘That’s all, stop editing! Happy blogging.’
  • Add the following code:
define('DISABLE_WP_CRON', true);

How Can We Disable WP-Cron in WordPress_

Once you have added the above code to the wp-config.php file, save it and then upload it to your site again. This will likely disable wp-cron in WordPress.

Setting Up a Proper Cron Job on the WordPress Host

After disabling wp-cron in WordPress, you must create a cron job that helps you run your scheduled tasks properly. If you use a host with cPanel, creating a cron job through their control panel is easy. To create a cron job, follow the steps below:

  • Log in to cPanel and click Cron Jobs through the Advanced section.
  • Under the Add New Cron Job section, select your desired schedule from the pre-defined schedules. A web hosting provider monitors the cron jobs and limits their runtime. For instance, twice per hour is common for most web hosting services.
  • Add the below command and remember to replace https://domain.com with your site’s URL. This command may change depending on the configuration of your hosting service. Click the “Add New Cron Job” after adding the command.
wget -q -O - https://domain.com/wp-cron.php?doing_wp_cron >/dev/null 2>&1

Note: The >/dev/null 2>&1 part helps deactivate email notifications.

Use a Third-Party Service to Set Up a Proper Cron Job

A third-party cron service can help you set up a proper cron job. The best thing about these services is that they help site owners and developers configure cron jobs without fuss.

Cronitor is a Dedicated Cron Service

You can easily use various dedicated third-party cron services, including:

  • Cronitor
  • EasyCron
  • cron-job.org
  • Better Stack
  • Cronhub
  • Healthchecks

Best Practices to Follow After Deactivating WP-Cron

After disabling wp-cron in WordPress, you should follow a few recommended practices, including:

Regularly Monitor Your Cron Jobs

It is not harmful to check if the scheduled tasks on your server run appropriately. Check the logs to see if the scheduled tasks run smoothly or if there are any issues.

Benefit from WP-Cron for Non-Essential Tasks

You can use wp-cron to conduct less crucial tasks like checking for updates. Likewise, wp-cron can help you check for plugin updates.

Increase Cron Frequency

If you manage a large WordPress site, executing cron tasks every hour may help you improve the productivity of your site. In other words, running cron tasks can considerably enhance a website’s performance.

Wrapping Up

We expect you to appreciate our blog post on disabling wp-cron in WordPress. Whether you manage a small or large WordPress site, disabling wp-cron and setting up proper cron jobs will help you enhance its performance.

Therefore, you must disable wp-cron in WordPress and set up proper cron jobs using the above methods. However, you can benefit from the dedicated third-party cron services like Healthchecks, Cronitor, and more if the manual cron job configuration is not your forte.