Do you need cron? | StudyObject

How to Replace WordPress Cron with Linux Cron Job

Do you care about how cron works in the operating system?  Cron is time based task scheduling system. You can schedule a cron job at a particular time. It can be scheduled to check updates or any other task.

What is WordPress Cron?

WordPress cron is a mechanism defined to trigger a scheduled event on every page load. On every page load (Page load happens when anyone visits your website) wordpress cron, which is defined in wp-cron.php file checks the list of scheduled tasks which needs to run.

Imagine your website getting 1000s of visitors, the wp-cron.php will be scanned 1000s times to check for the list of scheduled tasks. This will not only take more of CPU and RAM, but also lead to additional load time for new visitors of your website. According to the report, If you website takes more than 3 seconds to load, 53% visitors will switch over to similar other websites.

We will discuss today on the Linux cron job versus WordPress con job and which one is better and how to schedule wordpress cron to optimise the use of expensive resources like CPU and RAM.

Let’s say your website does not have any visitor for a long period of time( say a week ). In this scenario, there is a certainty that your wordpress cron will not get triggered and will not do any work required to be done by wordpress cron. Due to this reason your any of scheduled tasks will not run. Even your website will not get important updates required. Let’s say you scheduled a post at 3 PM, if on that day, no one visits your website, there will be scheduling error and your post will not get published.


Understanding the Linux/Wordpress Scheduler Job      ( Do not Miss this Part )


There is a catch here, with the Linux scheduler, if the time passes and the task did not run, it will not be re-attempted if Linux scheduler is not scheduled to run with an interval. So make sure the Linux scheduler executes the cron command on an interval. Usually it makes sense to maintain a small regular interval .


Do the change


Set up the linux cron job for wordpress every five minute.

  1. Disable wordpress cron

          Add following in wp-config.php in public_html folder

          define(‘DISABLE_WP_CRON’, true);


2. Add below command and schedule it to run at a regular interval.

         Assuming xyz is your website.

         You can set up command via cron job tool in your account using either of below mentioned commands.


wget -q -O – >/dev/null 2>&1



/opt/cpanel/ea-php-73/root/usr/bin/php /home/xyz/public_html/wp_cron.php




Cron plays an important role in the entire system functioning and must be handled correctly.


Author: Rajnish K

About Author :

Rajnishk is a Serial Entrepreneur, R&D Expert and is passionate for  Full Stack. He can be reached at [email protected]

StudyObject © 2020. All rights reserved.