How to Replace WordPress Cron With A Real Cron Job

wpcron-missed-scheduleWe are all too familiar with the “Missed Schedule” status, aren’t we? I am sure it is very frustrating to see that all your scheduled posts went MIA.

WordPress comes with its own cron job that allows you to schedule your posts and events. However, in many situations, the WP-Cron is not working well and leads to posts missed their publication schedule and/or scheduled events not executed.

To understand why this happen, we need to know that the WP-Cron is not a real cron job. It is in fact a virtual cron that only works when a page is loaded. In short, when a page is requested on the frontend/backend, WordPress will first load WP-Cron, follow by the necessary page to display to your reader. The loaded WP-Cron will then check the database to see if there is any thing that needs to be done.

Reasons for WP-Cron to fail could be due to:

  • DNS issue in the server.
  • Plugins conflict
  • Heavy load in the server which results in WP-Cron not executed fully
  • WordPress bug
  • Using of cache plugins that prevent the WP-Cron from loading
  • And many other reasons

There are many ways to solve the WP-Cron issue, but the one that I am going to propose here is to disable the virtual WP-Cron and use a real cron job instead.

Why use a real cron job?

By using a real cron job, you can be sure that all your scheduled items are executed. For popular blogs with high traffic, using a real cron job can also reduce the server bandwidth and reduce the chances of your server crashing, especially when you are experiencing Digg/Slashdot effect.

Scheduling a real cron job

To configure a real cron job, you will need access to your cPanel or Admin panel (we will be using cPanel in this tutorial).

1. Log into your cPanel.

2. Scroll down the list of applications until you see the “cron jobs” link. Click on it.


3. Under the Add New Cron Job section, choose the interval that you want it to run the cron job. I have set it to run every 15minutes, but you can change it according to your liking.


4. In the Command field, enter the following:

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

Replace with your website URL.

5. Click the “Add New Cron Job” button. You should now see a message like this:


6. Next, using a FTP program, connect to your server and download the wp-config.php file.

7. Open the wp-config.php file with a text editor and paste the following line:

define('DISABLE_WP_CRON', true);

8. Save and upload (and replace) this file back to the server. This will disable WordPress internal cron job.

That’s it.

To test it out, it is best to schedule a post 5 – 10 minutes after you have completed the above configuration. Wait and see if the WordPress internal cron job is fired. If yes, then congratulation, you have successfully scheduled a real cron job for WordPress. If no, go through the steps above and see if you have made any mistake. Alternatively, contact your web host and get them to configure for you.

Published by


Damien Oh is the owner and chief editor of Make Tech Easier

41 thoughts on “How to Replace WordPress Cron With A Real Cron Job”

  1. i’m a little bit confuse with cron, cron-wp etc… i need to update a table one a day. and i built the function level_update. Where do i need to insert that function? in wp-cron.php?

  2. Cool, this was the explanation that i was looking for =).
    Just a question, what would happen if the cron takes 30 minutes or one hour to finish, because you are running all the crons every 15 minutes, WP keeps a track of what crons are running or something like that?

  3. So I have a plugin that relies on wp-cron. When certain things are updated in the backend it runs WP Cron. For that reason, I don’t want to define(‘DISABLE_WP_CRON’, true); Do you think there would be any problems if I run crontab AND keep WP_CRON enabled?

  4. Will this work for Multisite? Seems like I saw somewhere that wp-cron had to be called for each site on the network when using Multisite.

  5. wp-config.php does not do the cron job. The file that does the cron job is the wp-cron.php. So it is logical to “fire” the wp-cron than then “wp-config”.

  6. I understand what you mean now. The wp-config.php is the file that contain all the configuration options. Since we want to disable the wp cron, wp-config is definitely the place to go. However when executing the actual cton job, the file to be called us wp-cron.

    Hope this is clear.

  7. Hi Damien! I bought a plug in called Follow Up Emails to work in conjunction with Woo Commerce and I have it set to send a follow up email 2 minutes after a product order is processing. It is not working! These are actual orders so I’m not sure it fits into the category you describe above. The Follow Up Emaill seems to work ok when I ask it to send 2 minutes after the order is completed but I have to manually check it as completed and it is not convenient for customers to wait for me to check the completed box to get their downloads, etc. Do you think going through the process you describe would help to fix my situation? Thanks in advance! Are you available for hire to troubleshoot??

  8. There are few possibilities: The followup email is not hooking to the correct action, that why it is not firing off after the order is completed. Alternatively, the followup email could be working fine, but the cron job is not firing. I think you will need to contact the developer and have him/her to look into the issue. If you need my help, feel free to contact me at twitter @damienoh.

  9. What will the behaviour be if you setup the Cron job but don’t specify DISABLE_WP_CRON. For example if Cron job stops working I would still like WP to continue doing “lazy mans” (at page load) cron tasks. So can you have the cake and eat it too?

  10. Nope. It doesn’t matter because they are all calling the same function. On a side note, if you are running a heavy cron job in the backend, calling it frequently (by not enabling DISABLE_WP_CRON) might add burden to your server.

  11. Hi Damien – could you explain why we need to use wget to trigger the cron (ie: making a roundtrip through the network interface and the webserver), instead of running the PHP script directly on the host?

  12. Thanks for your great tutorial! Now, the WordPress Plugin for my Newsletter askes me for a “secret hashtag”. Do you have any idea where I can find this or what I have to do?

  13. I think by default WordPress will run unpredictably when called from the command line. For example, it expects to see a $_SERVER[‘REQUEST_URI’] and other globals when run. I’m sure you could rig something up to execute the crons through the command line, but it wouldn’t be as supported as this wget method is on most hosting setups.

  14. For users whose cloud server doesn’t have Cron, third party cron service like is a good alternative. It’s quite reliable with log and email notification feature.

  15. Thanks so much for this. I just followed your instructions this morning, and I FINALLY had a scheduled post actually work! This was hugely helpful!

  16. Your “4. In the Command field, enter the following:
    wget -q -O – >/dev/null 2>&1 ”

    doesn’t match the “add new cronjob” screenshot and result screenshot. its missing “/dev/null” infront of the url.
    and there’s this “q” that isn’t in your actual example.
    Any clarification?

  17. Thanks Damien, this fixed my issue. I was not getting order confirmation e-mails sent to my Customers and myself, on completion of a successful order. This kicked it back into action. Very grateful for your assistance.

Comments are closed.