Xem thêm

Event Scheduling and wp-cron: A Comprehensive Guide

Introduction Are you struggling with scheduling events on your WordPress website? Look no further! In this article, we will delve into the world of event scheduling and explore the wp-cron functionality in WordPress. Get ready...


Are you struggling with scheduling events on your WordPress website? Look no further! In this article, we will delve into the world of event scheduling and explore the wp-cron functionality in WordPress. Get ready to discover a reliable solution for running scheduled events at specific times and frequencies.

About wp-cron

WordPress comes with a built-in system called wp-cron, which allows PHP functions to run at designated times. Unlike a true UNIX cron, wp-cron relies on page loads to check for scheduled tasks. This means that the frequency of wp-cron execution depends solely on website traffic.

To leverage wp-cron, here are a few options available to you:

  1. Within a page or post in WordPress, utilize the "Schedule Event" feature to set a publish date.
  2. Add a new cron event using the wp_schedule_event function within your theme or plugin code. The WordPress Codex article provides helpful code examples.
  3. Schedule an event using WP CLI. You can find a full list of wp cron event commands here.

Event Scheduling and wp-cron Caption: Event scheduling simplified with wp-cron

While WordPress does offer some scheduling capabilities, many website managers prefer more comprehensive tools for event scheduling. WP Crontrol and Advanced Cron Manager are popular cron plugins that have proven successful for many users.

Technical Information

To help you understand the inner workings of wp-cron, here are a few technical details:

  • After creation, a cron event is added to the wp_options table.
  • Easily manage crons using a plugin like WP Crontrol or Advanced Cron Manager.
  • If you're using WP CLI, you can view crons by running wp cron event list. For a full list of cron commands, click here.
  • Whenever a page on your WordPress site is visited, WordPress triggers wp-cron.php. This process queries the list of wp-crons for any that are due and executes them accordingly.

Missed Cron

While wp-cron generally works well, it can lead to two common issues:

  1. Low traffic: If your site doesn't receive much traffic, crons will not run frequently as they rely on page visits. This is often the main reason for missed scheduled events.
  2. High traffic: On the flip side, if your site experiences high levels of traffic, the frequent triggering of the cron checking process can strain your server. This might result in performance issues, such as slowness and timeouts.

WP Engine Alternate Cron

Fortunately, WP Engine offers a solution to resolve both of these problems – WP Engine Alternate Cron. By enabling this feature, you can ensure that "due now" crons are checked every minute, regardless of website traffic.

WP Engine Alternate Cron also provides a workaround for running other processes that require a schedule, mimicking true server side crons. To enable Alternate Cron, simply reach out to WP Engine Support.

Please note that enabling WP Engine Alternate Cron requires setting define( 'DISABLE_WP_CRON', true ); in your site's wp-config.php file. Reaching out to Support is necessary to ensure the server configuration option is toggled on for each environment.

However, it's essential to keep in mind that Alternate Cron may conflict with certain custom functionality, so testing may be necessary after enabling the feature. Additionally, Alternate Cron doesn't work for sites utilizing custom password protection.


If your site encounters issues with cron events or you find that enabling Alternate Cron doesn't solve the problem, follow these troubleshooting steps:

  1. Determine whether the crons are failing or if the updates are not displaying correctly. If the cron process is functioning, but updates aren't showing, a cache issue may be the culprit rather than a cron issue.
  2. If crons are failing to run, locate the Site Access Logs and search for wp-cron.php. Entries like 200 denote a working cron, while 502 suggests a timeout issue. Optimize your cron process to complete within 60 seconds to resolve timeouts.
  3. For advanced troubleshooting, consider the following:
    • Confirm that the domain added in the User Portal matches what is mapped within WordPress. If using a subdomain WordPress multisite, add each subdomain to the User Portal individually.
    • Use WP CLI to check if crons are stuck or not by running wp cron event list. Crons scheduled for next_run: now should update if cron is functioning correctly. If they're not updating, run wp cron event run -due-now to identify any potential hiccups in the process.
    • Note that sites using basic authentication, including transferable sites, will not work with wp-cron.
    • Check the site's error logs as an error in the theme, plugin, or core code could be causing issues with the PHP code in the cron.

If you've exhausted all troubleshooting options and still need assistance, don't hesitate to reach out to our Support team for further guidance.


By understanding the ins and outs of wp-cron and utilizing WP Engine Alternate Cron when necessary, you'll have a powerful toolset for managing scheduled events on your WordPress site. Say goodbye to missed cron events and hello to efficient event scheduling!

Next Step: Learn how to diagnose and troubleshoot a 502 error.