This guide is for advanced users.
Disabling the WP-cron function
The built-in WordPress cron function is only called when customers visit your website, e.g. browse product pages. You may replace a WordPress cron with a server one. In this way, it will not depend on the traffic on your site.
Add the following line of code to wp-config.php. The file is located in your site's main directory. Insert the following line of code there:
Adding a command to a server cron
In the next step, add the right task to the server cron. This task will automatically run the WP-cron function every certain period. Below are the instructions for the cPanel system. The procedure looks similar on other server management systems as well:
Log in to the cPanel hosting management system and select Cron jobs:
In the next step, add a new cron task, giving the following sequence as a command:
wget -q -O - https://woo.shop.com/wp-cron.php >/dev/null 2>&1
Replace the phrase woo.shop.com with the address of your WooCommerce store.
In this example, we suggest executing cron every minute. On weaker and shared servers it is a good idea to set it every 10 or 30 minutes.
You can use an external service to run the cron
Sometimes, there is no option to add cron jobs in your hosting management panel. In that case, the free service cron-job.org will come in handy. A robot will automatically run wp-cron on your website according to the schedule. To set it, create an account with the service and add a new task:
Enter the address in the second field (with the address of your store ):
Please remember to replace the phrase woo.shop.com with the address of your WooCommerce store here as well.
The final result
Thanks to the above steps, cron in your site will always be performed. Thanks to this you will be sure that the cyclic WordPress core tasks and those performed by WP Desk plugins will always be performed. Some of them are:
- sending emails with the Advanced Sending add-on to the Flexible Invoices PRO plugin
- creating basic invoices reports in WooCommerce