info[@]myquests.org | WA +49 (0)174 9151 757

How to Change WordPress Cron with a Genuine Cron Job

How to Substitute WordPress Cron with a Genuine Cron Job
Ever experienced missing scheduled posts in WordPress? Although WordPress has an inbuilt cron feature for managing your blog's posts and events scheduling, WP-cron isn't an actual cron job.

Definition of Cron Job: A cron job is a scheduled task in Unix-like operating systems that automates repetitive tasks at specific times or intervals. It uses the cron daemon to execute commands, scripts, or programs without manual intervention.

How to Substitute WordPress Cron with a Genuine Cron Job

Ever experienced missing scheduled posts in WordPress? Although WordPress has an inbuilt cron feature for managing your blog’s posts and events scheduling, WP-cron isn’t an actual cron job.

Linux Cron Job vs. WP-cron

Linux cron jobs can be controlled by users, ensuring that scheduled tasks are executed accordingly. Moreover, for high-traffic WordPress sites, a Linux cron job can help minimize downtime by reducing server bandwidth and conserving resources.

WP-cron, on the other hand, is a virtual cron that operates only when a page loads. WordPress activates WP-cron upon a page request on the site’s frontend or backend, subsequently displaying the required page to the visitor. While convenient, WP-cron is prone to failure due to various reasons, such as:

  • Plugin conflicts
  • DNS-related problems
  • WordPress glitches
  • Caching plugin usage
  • Heavy server load

How to Substitute WP-cron with a Linux Cron Job

How to Substitute WP-cron with a Linux Cron Job To enhance the effectiveness of your WordPress cron tasks, it’s ideal to disable WP-cron and establish a regular cron job via cPanel, configured to run hourly.

  1. Disable WP-cron:
    • Access your WordPress installation files using an FTP client or File Manager in cPanel.
    • Locate and open the wp-config.php file.
    • Add the following line of code before the /* That's all, stop editing! Happy publishing. */ comment:

  define('DISABLE_WP_CRON', true);

Set up a Linux cron job through cPanel:

  • Log in to your cPanel account.
  • Navigate to the “Cron Jobs” section.
  • In the “Add New Cron Job” area, choose the “Hourly” option from the “Common Settings” dropdown menu.
  • In the “Command” field, enter the following line, replacing “yourwebsite.com” with your website’s URL:

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

  • Click “Add New Cron Job” to finalize the process.

Now, your Linux cron job will run every hour, ensuring better reliability and performance for your scheduled tasks in WordPress.


For multiple WordPress sites

If you have multiple WordPress sites, it’s essential to stagger your cron jobs to prevent them from running simultaneously, which could lead to site restrictions or CPU issues. Follow the instructions below to stagger multiple WordPress cron jobs with advanced configuration:

  1. Determine the ideal time interval for each cron job:
    • Depending on the number of WordPress sites and server resources available, decide on a suitable time interval for each cron job to prevent overlapping. For example, if you have three sites, you could set cron jobs to run every 20 minutes, staggering them by 10 minutes each.
  2. Set up staggered Linux cron jobs through cPanel:
    • Log in to your cPanel account.
    • Navigate to the “Cron Jobs” section.
    • In the “Add New Cron Job” area, use the “Minute,” “Hour,” “Day,” “Month,” and “Weekday” fields to define the custom schedule for each of your WordPress sites, staggering them according to the interval you’ve determined.
    For instance, using the example of three sites with a 20-minute interval staggered by 10 minutes each:
    • Site 1: */20 * * * *
    • Site 2: 5,25,45 * * * *
    • Site 3: 10,30,50 * * * *
    • In the “Command” field, enter the following line for each site, replacing “yourwebsite.com” with the respective website’s URL:

  wget -q -O - https://yourwebsite.com/wp-cron.php?doing_wp_cron >/dev/null 2>&1
  • Click “Add New Cron Job” to finalize the process for each site.

By staggering your cron jobs, you can avoid CPU issues and ensure smoother performance for all your WordPress sites.


Step 1: Disable wp-cron.php

Disabling WP-cron can be done by modifying the wp-config.php file found in your WordPress site’s document root.

To disable wp-cron.php:

1. Access your WordPress installation files using an FTP client or File Manager in cPanel.

2. Locate and open the wp-config.php file.

3. Locate the <?php tag, and add a new line right after it.

4. Insert the following code on the new line:


  define('DISABLE_WP_CRON', true);

5. Save the changes and close the file.

With these steps completed, WP-cron is now disabled, and you can proceed with setting up a Linux cron job as a substitute.

Step 2: Set up Linux Cron

Before setting up Linux cron jobs, it’s essential to have a basic understanding of Linux commands.

To set up a Linux cron job:

1. Log in to your cPanel account.

2. In the “Advanced” section, click “Cron Jobs.”

3. Under “Add New Cron Job,” select the time interval. It is recommended not to set the interval lower than 15 minutes.

4. Set the cron command to the following, replacing “yourwebsite.com” with your actual domain name:


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

This command instructs the Linux server to execute wp-cron via wget, triggering the wp-cron.php script according to your schedule instead of on each page view.

5. Click “Add New Cron Job” to finalize the cron setup.

To test the new cron, wait for the specified interval for the cron to run. If the cron does not execute, review the steps listed above to ensure all steps were completed correctly.


Staggering Multiple WordPress Cron Jobs

Creating cron jobs for multiple WordPress sites without custom configuration can cause them to run simultaneously. This can lead to increased CPU usage, negating the benefit of using Linux cron jobs.

To stagger your cron jobs:

  1. Divide 60 by the number of WordPress installations you have. If you have more than 60, use the number 1. For example: If you have 6 WordPress installations, 60 divided by 6 equals 10.
  2. When creating your WordPress cron jobs, use 0 for minutes for your first cron job.
  3. For each cron job after the first one, add the number you obtained in step 1 to the minutes field.

Note: If you have more than 60 WordPress sites, after you reach 59, you will need to start at 0 again. If you experience CPU issues with this many WordPress sites running cron jobs this frequently, you may want to consider migrating some of your sites to a second account.

By following these steps, you will ensure that your WordPress cron jobs run once per hour and that there is minimal overlap between them, significantly improving your CPU usage with this platform.

More To Explore
influencer marketing and social media marketing
Social Media Marketing
Olivier Jacob
Social Media Marketing Action Plan

Struggling to navigate the ever-evolving world of social media? Don’t worry, we’ve got you covered! This article outlines a comprehensive social media marketing strategy designed

Read More »
Do You Want To Boost Your Business?
Drop us a line and keep in touch
Service Team discussing Strategy
small_c_popup
There is only one Stupid Question, the one not asked.
Let's have a chat