wp-cli wp-cron

Setting Up Reliable WordPress Cron

We all know wp-cron can be unreliable if left on default WordPress setting, WordPress’s behaviour on maybe I will run maybe not for wp-cron in a case of sites with less traffic.

There are following solutions to solve this problem. All require to disable default WP cron.

This will work for both single and multisite WordPress installation.

  1. Linux Crontab
  2. For Scalable and time-sensitive cron jobs.
  3. Sites like Pingdom and Uptimebutler (Not covered)

1. Linux Crontab

This script will work on both WordPress multisite and single site.


Make the script executable:

chmod +x

Test it by running ./ If it does not output anything go to next step else fall back.

Every user has their own crontab so I’ll recommend editing your Nginx / Apache user’s crontab ( www-data or http )

To edit run:

crontab -e -u {user-name}

And add the following line and update your script path

* * * * * /some/folder/

This will tell Linux to check for wp-cron every minute and if there is any new cron yet to execute in a pipeline it will execute it.

You can update cron time according to your preference, This site may help to understand parameters.

2. Scalable and time-sensitive cron jobs.

If you want a highly scalable cron then I strongly recommend checking the following repo:


☝️It’s recommended for sites with high traffic which is relying on cron and running time-critical cron.

Both require different setup you can find that on their github/product page and pick one which you feel works for you.

Disable default cron

Lastly, disable wp-cron by adding this line in wp-config.php

define( 'DISABLE_WP_CRON', true );
// Mind space WPCS.

You can test if cron is running by wp cron event list

And that’s it. ?


Backup WordPress site using Dropbox and wp-cli ?

Here is how you can backup small site using wp-cli and dropbox.

Go to:

Create new app call it anything it’s gonna be your private app.

Generated access token and save it somewhere in your locker 🙂

Download file and change directories path and DROPBOX_TOKEN

sudo chmod +x

Setup crontab with crontab -e add following line there

0 5 * * * /root/ > /dev/null 2>&1

This will backup site everyday at 5 am.


  • This scripts assumes your installation will be under if not it’s time to fork this and modify script.
  • This will backup your WP tables and wp-content folder.
  • You can also change path of
  • You should clean up your dropbox folder before you run out of memory.
  • Modify crontab if you want to change backup interval to less frequent or more frequent.