Skip to main content

Cron Jobs

Any WordPress site needs to run cron jobs to optimize, clean up, run checks and so much more. Out of the box, WordPress runs its background jobs whenever a visitor requests a page. This might mean that visitors needs to wait a seconds longer until the page actually loads. To solve this issue, WordPress allows you to disable cron jobs on the frontend and handle it yourself.

WPCS disables frontend cron jobs for you and runs cron jobs for every tenant every 15 minutes. Cron jobs are run via the WordPress CLI.

You can locally check if all your required background processes run via the WP CLI. Firstly, make sure you disable 'frontend' cron jobs. Add define('DISABLE_WP_CRON', true); to your local wp-config.php file:

wp-config.php
<?php

[...]

define('DISABLE_WP_CRON', true);

[...]
note

You do not have to worry about adding this code to your product in WPCS, we handle the wp-config.php and its settings for you.

After disabling the frontend cron jobs, open a terminal and run the following command. You can check if all the background processes that need to run, are actually executed.

wp cron event run --due-now
note

Don't have the WP CLI installed? Check out wp-cli.org.