Why we use and suggest real cronjobs for our plugins (and WordPress)?

In this article we’ll explain benefits of using real cronjobs instead of interal WordPress cron.

First of all, a couple words about why do we have a need for cronjobs in our plugins like Simple Auctions, Lotteries and Group Buy. Custom product types (auctions, lotteries and deals) in these plugins have start and end timestamp and we need to have reliable way to fullfill start and end timestamps for auctions, lotteries and group buy / deals on time and to send email notifications in specified intervals (for example twice daily).

We cannot use WordPress cronjobs because they are not reliable and depend on visitor accessing your website. That means if your WordPress has say 3 visitors a day it will run internal WP cron 3 times that day (and we will be able to close auction only 3 times a day and not on end datetime set in auction). So if there is no site activity for say 3 days, the cron will not be triggered for 3 days but next time you have visit on your website.

Another problem – if there are a lot of pending tasks to be run by WP internal cron, user will have to wait for those to be executed and then website will load for user meaning bad user experience due to slow loading times (which are caused by WP internal cronjob running and executing pending tasks). Real server cronjobs do not depend on website activity and are run in fixed defined intervals as set in cronjob config.

It’s better to have maintenance tasks running in background by cron than by your visitors – one more reason to use either real cronjobs or external service like EasyCron. EasyCron has nice tutorial how to setup cronjobs for Simple Auctions (also useful for Lotteries and Group Buy plugin).

If your hosting company (hosting provider) does not support one minute cronjobs we suggest that you move your website to better (serious) hosting company (or use service like EasyCron).

One performance suggestion for your WordPress site – since you are allready setting up cronjobs, you could also setup main WP cron to be run by real cronjob (or EasyCron) so your visitors don’t load WP cron at all. You need to edit wp-config.php file and add this line:

define('DISABLE_WP_CRON', true);

Then set this cron (use either wget or curl – whatever your hosting supports, just don’t use both at same time!):

/usr/bin/wget -q -O https://domain.com/wp-cron.php?doing_wp_cron >/dev/null 2>&1


/usr/local/bin/curl --silent https://domain.com/wp-cron.php?doing_wp_cron >/dev/null 2>&1

Where you need to replace domain.com with your actual domain to your WordPress site and make sure to have right path to wget or curl (safest way to find out those is to contact your hosting provider).

With these in place you will have reliable way to do WordPress maintenance cron tasks and your visitors will have better user experience because your WordPress will load a bit faster since users will not run WP cron on every website access.