By default WordPress triggers cron to run while users are visiting your website. There are several good reasons why you should change this, to run directly from server instead. 

WordPress documentation says the following: WP-Cron works by: on every page load, a list of scheduled tasks is checked to see what needs to be run.

Follow these instructions to set up cron the right way

1. Disable WordPress builtin cron trigger

Edit **wp-config.php** and add (or uncomment if it already exists) 

define('DISABLE_WP_CRON', true); 

This will make your website spend less resources while users are visiting your website, resulting in faster and more consistent loading times.

2. Set up the cron job in the control panel

Go to your site's cron settings page in the admin panel and enter the following in the time field: 

*/10 * * * *

This will make the cron job run once every 10 minutes.

In the command field, enter the following:

wp cron event run --due-now --path=/kunder/group/user/public/ --quiet

Replace the path with the complete path to your public folder.

Finally click the "Add" button. Now the cron job has been added!

If you don't want email notifications when cron jobs have been executed, you can select the (newly created) cron job in the list of this page and select "Do not send email" in the drop-down box below. Click the "Update" bottom on the bottom of the page.

Note that you may still receive emails regarding cron jobs, if the cron job that was executed ran into some error. To eliminate these emails, fix the (code related) errors!

Did this answer your question?