Replace WordPress Cron With Real Cron Job Print

  • wordpress
  • 0

The default WordPress scheduling system can prove to be a huge resource hog. Slowing down your website for users and affecting your Search Engine Optimisation (SEO) due to the slow page loading times experienced.

Whats wrong with the default WordPress Scheduler?

The default WordPress scheduler uses the wp-cron.php file which is accessed every time a user visits a webpage on your WordPress site. This file checks for jobs that may need running such as publishing a scheduled post. We’ve seen this cause very long page loading times and high system resource utilisation on servers.

In addition, we’ve seen some WordPress add-ons run very resource intensive tasks on every cron job. So this can cause massive server loads on a busy website or when a bot comes crawling.

What should you use instead?

The default wp-cron should never be used on Farbyte shared hosting services, even on a small website, as all our clients have access to the much better job scheduling system of real Linux cron jobs.

These cron jobs can be configured from your cPanel account under Advanced -> Cron jobs.

How can I fix this?

1. Disabling WordPress Cron

You can disable the default, inefficient WordPress cron (scheduler) by entering the following into your websites wp-config.php file after the opening <?php tag:

define('DISABLE_WP_CRON', true);

2. Setting Up Real Linux Cron Job For WordPress in cPanel

  1. Login to your Farbyte cPanel account
  2. Go to Advanced -> Cron jobs
  3. Under the Add New Cron Job section:
    1. Select Once per 5 minutes (*/5 * * * *). NOTE: never anything less that every 5 minutes.
    2. Enter the following command, changing for your WordPress domain:
      cd /home/[PATH_TO_WORDPRESS_INSTALLATION]; php -q wp-cron.php &> /dev/null

      Where [PATH_TO_WORDPRESS_INSTALLATION] is the disk path to your WordPress site. For example, /home/mycpanelname/public_html/

    3. Click the Add New Cron Job button

That’s all there is to replacing the WordPress scheduled cron system with the much more efficient Linux cron job scheduler.

If you need any help setting this up or have any questions with regards the WordPress scheduler, please feel free to contact Farbyte support.

Was this answer helpful?

« Back