[Solved]: Disabling WP-Cron to Improve Overall WordPress Website Performance, Including WooCommerce

WordPress is one of the most popular content management systems available today. It provides an easy-to-use interface for managing your website’s content, but it also comes with some performance issues. One of these issues is WP-Cron, the built-in task scheduler that runs on every page load by default. In this article, we’ll look at how disabling WP-Cron can improve overall site performance, including WooCommerce.

What is WP-Cron?

WP-Cron is a built-in task scheduler in WordPress that handles scheduled tasks such as checking for updates, publishing scheduled posts, and running plugins and themes scheduled tasks. It works by triggering a script every time a page is loaded on your site. This means that every time someone visits your site, WP-Cron runs, whether it needs to or not. This can lead to performance issues, especially on sites with heavy traffic or resource-intensive tasks.

What are the Performance Issues with WP-Cron?

The main performance issue with WP-Cron is that it runs on every page load, even if there are no scheduled tasks to run. This means that it consumes resources and adds to the server load unnecessarily. In addition, if there are many scheduled tasks to run, they can cause delays and slow down your site’s response time, leading to a poor user experience.

How to Disable WP-Cron?

To disable WP-Cron, you need to add a line of code to your site’s wp-config.php file. The code will prevent WP-Cron from running on every page load, and instead, you can replace it with a server-side cron job that runs at set intervals.

To disable WP-Cron, add the following line of code to your site’s wp-config.php file:

define('DISABLE_WP_CRON', true);

Once you’ve added this line of code, WP-Cron will no longer run on every page load.

Setting Up a Server-Side Cron Job

To replace WP-Cron with a server-side cron job, you’ll need to create a new cron job on your server. A cron job is a scheduled task that runs at specified intervals. You can use a cron job to trigger the script that WP-Cron would have run on each page load.

To create a new cron job, access your web hosting control panel and locate the “Cron Jobs” section. Create a new cron job with the following command:

curl -s https://yourdomain.com/wp-cron.php?doing_wp_cron >/dev/null 2>&1


wget -q -O - https://yourdomain.com/wp-cron.php?doing_wp_cron >/dev/null 2>&1


cd ${HOME}/public_html; /usr/local/bin/php -q wp-cron.php > /dev/null 2>&1


/usr/bin/php8.1 >/dev/null 2>&1 /root_dir/www/user_id/htdocs/site.com/wp-cron.php?doing_wp_cron=1

Please make sure you use the correct path to wp-cron.php.

Alternatively, you can also use WP-Cli

cd /root_dir/www/user_id/htdocs; wp cron event run --due-now > /dev/null 2>&1


cd /root_dir/www/user_id/htdocs && /usr/local/bin/wp cron event run --due-now > /dev/null 2>&1

Replace “yourdomain.com” with your actual domain name (marked in red should be configured). This command will trigger the script wp-cron.php, which handles scheduled tasks in WordPress.

Set the frequency of the cron job to match your site’s needs. For example, if you publish several posts per day, you may want to run the cron job every 10 minutes.

Should Action Scheduler be disabled for performance and optimization?

Whether or not to disable Action Scheduler for performance and optimization depends on the specific needs of your site. Action Scheduler is a library that provides a scheduling system for WordPress, and plugins like WooCommerce commonly use it to schedule tasks such as sending order confirmation emails, updating product data, and performing other background tasks.

Like WP-Cron, Action Scheduler can consume server resources and affect site performance if it’s not optimized properly. However, completely disabling it may have negative effects on the functionality of your site, especially if you rely heavily on plugins that use Action Scheduler.

How to disable Action Scheduler?

You can disable Action Scheduler without a plugin by adding a code snippet to your theme’s functions.php file or to a custom plugin. Here’s how you can do it:

  1. Open your theme’s functions.php file.
  2. Add the following code snippet to disable Action Scheduler:
add_filter( 'action_scheduler_disabled', '__return_true' );

This code will disable Action Scheduler and prevent it from running scheduled tasks.

Note that disabling Action Scheduler may affect the functionality of plugins that rely on it. Make sure to test your site thoroughly after disabling it to ensure that all functionality is working as expected.

The server-side cron job, which we configured before, will also trigger Action Scheduler to run its scheduled tasks.

If you decide to re-enable Action Scheduler, you can simply remove the code snippet from your functions.php file

Performance for WooCommerce

If you’re running a WooCommerce store, disabling WP-Cron and setting up a server-side cron job is especially important for performance. WooCommerce uses scheduled tasks to update product information, send order notifications, and perform other important tasks. If WP-Cron is running on every page load, it can slow down your site and lead to delayed or failed tasks.

By disabling WP-Cron and setting up a server-side cron job, you can ensure that WooCommerce tasks are executed efficiently and on time. This can improve your store’s performance and provide a better user experience for your customers.


Disabling WP-Cron and replacing it with a server-side cron job is an effective way to improve your site’s overall performance. WP-Cron runs on every page load by default, which can consume resources and cause delays, especially on high-traffic sites. By disabling WP-Cron and setting up a server-side cron job, you can control when scheduled tasks run and ensure they are executed efficiently and on time.

This is especially important for WooCommerce stores, which rely on scheduled tasks to update product information, send order notifications, and perform other crucial tasks. By improving the performance of scheduled tasks, you can provide a better user experience for your customers and boost your store’s revenue.

If you’re not comfortable editing the wp-config.php file or setting up a server-side cron job, consider using a plugin to handle cron tasks. There are several plugins available that can help you disable WP-Cron and set up a server-side cron job with ease.

In conclusion, disabling WP-Cron and replacing it with a server-side cron job is a simple but effective way to boost your site’s performance, including for WooCommerce stores. It’s worth taking the time to implement this change and enjoy the benefits of a faster, more efficient website.

Share this post

Leave a Reply

Your email address will not be published. Required fields are marked *