Skip to main content

WP Cron and Events Manager

Events Manager does some of its work in the background: sending reminder emails, releasing unpaid bookings, clearing temporary files. It schedules that work with WP-Cron, the task scheduler built into WordPress.

WP-Cron has one weakness that matters for events. It only runs when somebody visits the site, so on a quiet site a task due at 9:00 may not run until the first visitor arrives at 11:30. This page lists what Events Manager schedules and shows how to make the tasks run on time.

Tasks Events Manager schedules​

Each task is only scheduled while the feature that needs it is switched on.

Events Manager​

Task (hook name)RunsWhat it does
em_booking_intents_expireEvery minute, while booking holds are onDeletes the leftover records of holds that ran out. Expired holds release their spaces whether or not this task runs.
em_uploads_api_cleanupHourlyDeletes temporary files left by uploads that were started and never submitted.
em_online_venues_queueEvery 5 minutes, when an online meeting provider such as Zoom is in useCreates and updates the online meetings for your events with the provider.
em_online_venues_syncHourly, with the task aboveChecks that those meetings still match their events.
em_upgrade_plugin_checkOnce, straight after a plugin updateRuns any database changes the new version needs.

Recurring events that are scheduled to publish at a future date also rely on WP-Cron, through the same task WordPress uses for scheduled posts.

Events Manager Pro Pro​

Task (hook name)RunsWhat it does
emp_cron_emails_queueDaily, at the WP Cron Time you setFinds the events coming up and queues their reminder emails. Scheduled while Enable Event Email Reminders? is Yes.
emp_cron_emails_process_queueEvery minuteSends queued emails in batches of up to 100, including the email that releases a hidden online event link.
emp_cron_emails_attachment_cleanupDailyDeletes the temporary calendar files attached to emails.
em_gateways_cronEvery minute, when a gateway has a payment time limit or the payment page is onDeals with bookings left unpaid past their time limit, so their spaces go back on sale.
emp_cron_waitlist_check_expiredEvery minuteExpires waitlist offers that were not taken up in time and offers the spaces to the next person.
emp_cron_minimum_capacityEvery minute, while minimum capacity is onChecks events against their minimum number of bookings.
emp_cron_process_past_eventsEvery minute, unless Past Events Action is Keep PublishedChanges the status of, trashes or deletes events that have ended.
em_automation_cron_minute, _hourly, _daily, _twicedailyAs named, when an automation uses a time-based triggerFires time-based automation triggers.
emp_cron_deposit_remindersDaily, when deposits, the payment page and balance reminders are all onEmails customers who still owe a balance.
emp_bookings_reclaim_executionsHourlyRecovers scheduled payment steps that started and never finished.
emp_cron_gmap_static_cleanupDaily, when static maps are cached with an expiryDeletes expired cached map images.

Add-ons Pro Plus​

Add-onTask (hook name)RunsWhat it does
Connectem_connect_reminders_cronDaily, at the reminder time set in ConnectSends SMS, WhatsApp and other message reminders.
Import/Exportemio_cron_hourly, _twicedaily, _daily, _twiceweekly, _weekly, _twoweeks, _monthlyAs namedRuns the imports and exports you set to repeat at that frequency.
Zoomem_zoom_refresh_series_meetingsDaily, when recurring events share a meeting seriesKeeps the series meetings in step with their events.
Zoom Proem_zoom_syncHourly, when syncing is onBrings in attendance and recordings from Zoom.
Xeroemp_xero_token_keepaliveDailyKeeps the Xero connection from expiring.

Several of these run every minute. WordPress can only keep to that if something triggers WP-Cron at least once a minute, which is the reason for the next section.

Make WP-Cron run on time​

The dependable setup is to stop WordPress from triggering WP-Cron on page views, and have the server trigger it on a fixed schedule instead.

  1. Open wp-config.php in the top folder of your WordPress install and add this line above the comment that says to stop editing:

    wp-config.php
    define( 'DISABLE_WP_CRON', true );
  2. In your hosting control panel, find the scheduled tasks screen (often called Cron Jobs) and add a job that runs every minute. In cron syntax that is * * * * *.

  3. Use one of these as the command, replacing the address with your own site's:

    wget -q -O - https://example.com/wp-cron.php?doing_wp_cron >/dev/null 2>&1
    curl -s https://example.com/wp-cron.php?doing_wp_cron >/dev/null 2>&1

    If your host has WP-CLI, this does the same without an HTTP request:

    cd /path/to/wordpress && wp cron event run --due-now >/dev/null 2>&1
  4. Save the job, wait a few minutes and check that it is running.

If your host only allows a job every 5 or 15 minutes, use that. Tasks then run at most that many minutes late, which is fine for reminders and clean-up. The one place it shows is unpaid bookings and waitlist offers, which expire up to that many minutes after their time limit.

If your host has no cron jobs at all, leave DISABLE_WP_CRON out and use an outside service that requests https://example.com/wp-cron.php?doing_wp_cron on a schedule. Uptime monitors and dedicated cron services both do this.

caution

Don't add DISABLE_WP_CRON without also setting up the job. With WP-Cron disabled and nothing calling wp-cron.php, no scheduled task runs at all: no reminders go out, and WordPress stops publishing scheduled posts.

Check that tasks are running​

  • With WP-CLI, wp cron event list shows every scheduled task and when it will next run. A task whose next run is well in the past is not being triggered.
  • Without WP-CLI, a plugin such as WP Crontrol shows the same list in wp-admin and lets you run a task by hand.
  • Tools then Site Health reports when scheduled events are running late.

Multisite networks​

Each site on a network has its own schedule. One call to wp-cron.php on the main site runs the main site's tasks only. Add a job for each site's address, or loop over the sites with WP-CLI:

wp site list --field=url | xargs -I % wp cron event run --due-now --url=%

Troubleshooting​

Reminder emails go out late or not at all

Check that the tasks are running, as above. Reminders are queued once a day at the WP Cron Time set in Events then Settings then Emails then Event Email Reminders and then sent by the every-minute task, so on a site with few visitors both steps wait for traffic. A server cron job fixes it.

Customers get the same reminder twice

On a busy site, page views can trigger WP-Cron several times at once. Moving to a server cron job, with DISABLE_WP_CRON set, means it is triggered once a minute and no more.

Unpaid bookings are not released on time

The time limit is checked by em_gateways_cron every minute. If WP-Cron runs less often, the booking is released at the next run after its limit.

Cron requests are blocked

Password protection, a maintenance mode plugin or a firewall rule on wp-cron.php stops both WordPress and your cron job from reaching it. Allow requests to that file, or use the WP-CLI command, which doesn't go through the web server.