Schedules, Events and Crons

Applies to:
WordPress Hosting

Difficulty:
Easy

Time Needed:
N/A

Introduction

WordPress has the ability to schedule posts and to run activities in the background or at specific times for example checking if plugin needs updating. Plugins and even themes can also add events into the WordPress scheduler to run background, for example getting information from a third party site every day.

The default method for running these scheduled events, uses a built in process that when a visitor or site admin performs an action on the site, any scheduled events are triggered at the same time. This means event’s don’t always actually occur at the time they specified, but rather the next time a visitor or site performs an action, which maybe hours later or for unpopular sites days.

The second problem, the person who was unlucky enough to trigger the schedule event now has to wait until it’s done before the action they wanted to do will occur. This means from their perspective the site may appear slow and sluggish. In extreme cases, such as doing large backups it may appear to make the site completely unresponsive or show errors.

To prevent this occurring the WordPress Hosting disables the built in wp-cron and instead runs the scheduled events via a cron job. Cron is software that runs inside your container and manages scheduled tasks for a range of other software. It’s reliable and well used solution. The wp-cron was even named after it, as the original goal was to mimic the systems cron.


Schedule Events + 5 minutes

Using the cron means events will occur in the background, regardless of interaction with your site. The cron runs every 5 minutes, this means any scheduled activities that were meant to occur since the last cron, will then be processed. This does mean if a post is scheduled to go live at 7.04 it might go live then or at latest it will be live by 7.09 depending when the cron next run is.

As a golden rule, scheduled events happen within 5 minutes of the stated time.


My plugin says crons are disabled

Some plugins will look to see if wp-cron is defined as true and if not put a warning or indeed prevent things running entirely as they don’t believe the cron is running. Normally this is older plugins and newer or updated plugins rely on WordPress to know scheduling is working.


While always tests, plugins which warn that wp-cron is disabled should still continue to function and such warnings can be disregarded. However if you do have issues please don’t hesitate to drop our support team a message.


Was this helpful?

   
4 people found this article helpful