Cron is a task management system on a server. It's a function by which WordPress handles scheduled tasks. It controls such basic functionalities as checking for updates periodically, publishing scheduled posts or automatically cancelling orders in WooCommerce after a certain time.
WP-cron is called each time a site based on WordPress is reloaded. It is a time when the list of tasks to be performed is checked. If the system detects any of the tasks should be executed, it will be done. Unlike the system cron, WP-cron does not check the task list at all times. The WP-cron function is only called when customers visiting your website, e.g. browsing product pages.
It is normal that users do not visit your store, in the middle of the night. The sequence of tasks will not be activated if there is currently no traffic on the site. If your store is not visited by many people and you would like to keep the task execution fully automated, follow these steps.
How to replace a wordpress cron with a server cron?
Disabling the WP-cron function
Start by turning off the scripts that cause the WP-cron function to perform every time you visit your WordPress-based website. Edit the wp-config.php file located in the main directory of the site and add a line to it:
Adding a command to a server cron
Then most importantly, you should add a task to the server cron that will automatically trigger the WP-cron function every specified time. Below is a manual for the cPanel system. If your hosting uses a different management system, the steps should be similar:
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:
Replace the phrase woo.shop.com with the address of your WooCommerce store.
Using an external service to run the cron
If your hosting service provider does not give you the opportunity to add a cron task in the hosting management panel, you can use the free service cron-job.org. The robot will automatically run wp-cron on your site every specified time. Create an account on the site and add a new task:
Enter the address in the second field:
Thanks to the above steps, cron in your site will always be performed. Even when there is no traffic on your site. 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: