How to set up a cron job

How to set up a cron job

A cron job runs a task automatically at regular intervals – for example a script that sends newsletters, creates reports or cleans up data. In the Control Panel you can either run a command or call a URL.

Step 1: Open the cron jobs

In the Control Panel, open your website, click Advanced in the top menu and choose Developer tools. Click Cron jobs on the left. You see all existing cron jobs with their command or URL and interval. Click Add cron job.

Cron jobs section with the Add cron job button and the Edit and Delete menu

Info

Good to know: If you have installed WordPress via the app installer, a cron job for WordPress (wp-cli cron event run --due-now) has already been created automatically. Do not delete it.

Step 2: Define the cron job

  1. Choose the Cron type: Run command executes a command on the server, Request URL calls a web address.
  2. Enter the Command or the Request URL, e.g. https://meinetestseite.ch/wp-cron.php.
  3. Choose the Interval: every minute, every 15 minutes, every hour, day, week or month – or Custom for your own schedule.
  4. Click Add.
Add cron job form with cron type, request URL and interval

Step 3: Check the cron job

The new cron job appears in the list with its interval. With the three dots (⋮) you can edit or delete it later.

Cron jobs list with the new daily cron job

Warning

Important: Leave the option Allow editing of cron from website container switched off unless you really need it. Malware in PHP or WordPress often tries to create its own cron jobs – this setting is therefore off by default.

Idea

Tip: Choose the interval as long as possible. A job that runs every minute puts unnecessary load on your website if the task only needs to run once a day.