I, like you, had incorrectly assumed that this was something I didn’t have to worry about. In reality, it turns out that WordPress Cron jobs will trigger only when somebody visits a webpage of your site. Let me quote WordPress.org directly (read more about Cron on WordPress.org):
WP-Cron works by: on every page load, a list of scheduled tasks is checked to see what needs to be run…WP-Cron does not run constantly as the system cron does; it is only triggered on page load.
The consequence is, that if you have a site that does not have a significant number of visitors coming to your site through-out the whole day, your going to find that tasks that have been scheduled to run, will not have run at all. In fact, it’s no accident that this happens in WordPress, WordPress will wait until somebody does visit and then try to execute all those tasks that have not run – that is what they call “WP-Cron”:
WP-Cron will run tasks regardless of how old they are. Tasks will sit in a queue until a page is loaded to trigger them, thus no task will ever be lost.
When they say “until a page is loaded” that can mean either that someone visits your site, that someone logs into the WordPress Admin, or that you remotely trigger the WordPress cron page (wp-cron.php).
Thanks to the Cronjob Scheduler plugin for WordPress, I found that it is possible to remotely trigger the WordPress cron page – thanks to standard Cron (for Linux/Unix) – so that all your scheduled tasks continue to run on time! Continue reading below and I will show you how…
This will require a little familiarity with working with Linux on the command line as you will need to use the console/terminal to create a new cron task on your hosting environment.
1: Connect to your webserver
You need to establish a connection from your computer to the server that is hosting your website. If your modifying a local site this is easy, otherwise you will need to use something like PuTTY on Windows or Terminal on Mac to establish what is called an “SSH connection”. You can visit MediaTemple for a great article on PuTTY for Windows or a great article for Terminal on Mac.
2: Create your cron task
Crontab is the file that contains the list of tasks that will be run with information about when they should be run. What you need to do is to edit this file and add another task that will trigger the WordPress cron page on a regular basis.
Having established your SSH connection, type the command
crontab -e. A text editor called Vi will open and show the contents of the crontab file. There might be nothing to show or there might be some existing entries already, but your going to need to add another line to the bottom of this file for your new task.
The line that you need to add looks like this:
* * * * * wget -qO- "[site URL]/wp-cron.php?doing_wp_cron" &>/dev/null
Note, you need to replace
[site URL] with the full URL of your own site (e.g. https://www.google.com).
Just to explain, those 5 stars at the start (
* * * * *) mean every minute (i.e. once every minute), followed by the command that will run (
wget -qO- "[site URL]/wp-cron.php?doing_wp_cron"), then a command to say what you want to do with the output of the previous command, which in this case is
&>/dev/null because we don’t want to do anything with the output.
To help you understand crontab lines even more, I would recommend playing with the Crontab Generator.
If you need some help with the Vi text editor, please visit A Beginner’s Guide to Editing Text Files With Vi. However, I would suggest that you copy the line that you need to add into a text editor on your own computer, make the changes, and then Copy + Paste into Vi.
Now that you have your new line in the crontab file, you need to Save + Quit Vi by pressing the Escape key followed by
After this you should see a message in red saying
crontab: installing new crontab, which basically means you are done setting up your new cron task!
A good way to check that your new cron task has been successfully installed is to run the command
crontab -l, which will list all the cron tasks installed for your account.
3: Update WordPress
Lastly, you need to edit your
wp-config.php file for your site by adding this one very simple line after the first
This says to WordPress “don’t run cron, because I’m taking care of it myself”.
What I would now recommend you do, is to download and install the Cronjob Scheduler plugin for WordPress. With this plugin installed, you will gain access to a page that lists all the cron tasks that have been scheduled to run and you will be able to keep an eye on them to make sure that they run on time.