loading

Why Your WordPress Cron Isn't Running On Time

WordPress doesn't run its scheduled tasks using the server's clock; instead, it ties them to visitor requests. When someone loads a page, that request checks if there are any tasks to run, and if so, it calls itself via wp-cron.php again. This is why you often hear that "if there are no visitors, the cron job is delayed," but I never actually measured who or how late it was being triggered. I decided to dig through 33 days of server access logs—a massive 2,819,012 lines—and filtered out only the cron calls. Across three WordPress sites over 33 days, there were 2,647 calls. After narrowing those down to 735 instances where the trigger could be identified, I found that nearly half—45.9%—were coming from attack scanners hitting the login page and xmlrpc.php, not actual visitors. Furthermore, my tests confirmed that some of these were "empty calls" that triggered the cron job but did absolutely nothing.

How I Tracked It Down

The access logs for this server are a jumble of requests from multiple sites. Luckily, WordPress sends cron requests to itself with the site's URL included in the User-Agent (e.g., WordPress/7.0.4; https://kilho.org), which allowed me to separate the data by site. My scope was five rotated logs covering a 33-day period, from midnight on August 9, 2026, to midnight on September 11.

Site Cron Calls Avg. Per Day Daily Min–Max
kilho.org 934 28.3 24–49
damyo.net 883 26.8 24–31
Network Root (Private) 830 25.1 12–43

The reason these sites average around 24 calls per day is that all three have one event, wp_privacy_delete_old_export_files, that runs hourly. The other events run on 12-hour, 1-day, or 1-week cycles, so they just add a few calls to the daily total. Since there are no plugins, all the activity comes from the 9 to 12 core events.

The calls themselves are lightweight. When I manually POST to wp-cron.php when there's nothing scheduled, the response time was between 30ms and 135ms, which is faster than loading the homepage (200–230ms). The real issue isn't the call itself; it's whether it happens on time.

How Much Did a One-Hour Event Actually Lag?

When WordPress reschedules a recurring event, it adds the interval to the original scheduled time. Even if it runs late, the next scheduled time doesn't get pushed back. Because of this, the scheduled time for a hourly event is fixed to something like "X minutes and Y seconds past the hour," and the difference between that scheduled time and the actual call time in the logs is the delay. I found the two-minute window where calls are most frequent over three days of logs and used the start of that window as the scheduled time (the margin of error is within 10-second estimates).

Site Time Slot Median Delay Top 10% Maximum Slots Delayed Over an Hour
damyo.net 790 73 seconds 512 seconds 3,547 seconds 0
kilho.org 781 220 seconds 886 seconds 3,556 seconds 9 (1.2%)
Network Root 775 322 seconds 2,201 seconds 3,578 seconds 125 (16.1%)

Looking at the delays by interval makes the difference between sites even clearer.

Delay damyo.net kilho.org Network Root
Under 10 seconds 7.5% 7.9% 2.6%
10 seconds to 1 minute 39.1% 15.5% 10.6%
1 to 5 minutes 32.4% 36.8% 34.2%
5 to 15 minutes 16.8% 30.2% 25.8%
15 to 30 minutes 2.4% 7.9% 12.2%
30 to 60 minutes 1.8% 1.7% 14.6%

On this server, the longest gap without a request was 127 seconds over 33 days. There was never a time when it was quiet for more than 5 minutes. Yet, half of the time events on kilho.org were delayed by over 3 minutes and 40 seconds, and about one in ten times they were delayed by nearly 15 minutes. Requests are coming in at about one per second—so why the delay?

More Requests Don't Mean Cron Runs Faster

The reason is that most of the requests in the logs aren't actually hitting WordPress. We have over ten other sites running on the same server, so the request that actually triggers the cron job is the one that fully loads the WordPress site for kilho.org. Static files like images and CSS bypass PHP, so they don't trigger anything. This means that for kilho.org, a request that reaches PHP only happens every few minutes, and that interval directly causes the cron delay. Damyo.net is faster not because its content is better, but because it receives a slightly higher volume of requests.

The network root site is essentially an empty site blocking search engine indexing, so it rarely gets real visitors. As a result, 16% of the time, the scheduled event ran over an hour late. This is exactly what happens when you have a WordPress site with no visitors—scheduled posts get pushed back. We covered the cause of scheduled posts showing up as "missed reservations" in a previous post, but that time we only covered the theory; this time, we have the actual delay distribution.

Who Triggers It? Requests in the Second Before the Cron Runs

A cron call is logged in the same second as the request that triggered it. So, we filtered for cases where only one request (excluding static files and requests from the server itself) came in during the one-second window right before the cron call, and we flagged that as the trigger. Out of 1,825 instances across both sites, we narrowed down the potential triggers to 735 cases (40.3%). We excluded the rest because they had two or more requests in the same second, or zero requests (since log times are based on request start, longer requests show up later).

Type of Triggering Request kilho.org damyo.net Total
Attack/Exploration Paths (xmlrpc.php, wp-login.php, install.php, .env, etc.) 143 (37.0%) 194 (55.7%) 337 (45.9%)
Bot/Tool User Agents (Search/AI Crawlers, curl, python, etc.) 109 (28.2%) 80 (23.0%) 189 (25.7%)
Normal Page Load via Browser User Agent 122 (31.5%) 63 (18.1%) 185 (25.2%)
Other 13 11 24 (3.3%)
Bar chart of cron requests
Nearly half of the requests that triggered the cron job were attack or discovery requests hitting xmlrpc.php and wp-login.php.

Looking at the paths, xmlrpc.php accounted for 167 requests, the homepage (/) had 142, wp-login.php had 115, and then there were 16 requests to wp-admin/install.php. Just because a request has a "Browser UA for a normal page" doesn't mean it's a human. Many scanners use Chrome User Agents. On the flip side, the bots we saw included Googlebot, Ahref sBot, SemrushBot, and ping requests from WordPress.com. Even if we generously say one out of every four requests that triggered the cron job was from a human reading the content, it's a small fraction.

I wrote a post about why this server blocks access to xmlrpc.php, but when I actually measured it, the requests hitting xmlrpc.php were the ones triggering the cron job the most. If you block those requests, the calls that were triggering the cron job disappear, which actually causes the delay to increase. Security measures and cron job delays are two sides of the same coin.

The Cron Jobs Triggered by install.php Did Nothing

Between 4:22 AM and 4:24 AM on September 10th, kilho.org's cron job was called a total of 21 times. Normally, it should only run once per hour. At the same time, the logs showed a single IP address hitting the installation files—specifically at paths like /wp/wp-admin/install.php, /old/wp-admin/install.php, and /test/wp-admin/install.php—44 times. Each time the request returned a 200 status, the cron job was triggered once.

Over the entire 33-day period, there were 709 requests to install.php (from 133 different IPs, spread over 30 days). Immediately following those requests, there were 54 cron calls recorded for kilho.org and 12 for the network root.

Why Were So Many Cron Jobs Triggered?

At first, I thought maybe the locking mechanism wasn't working. WordPress uses a temporary value, or transient, called doing_cron to record a timestamp and prevent the cron from running again for 60 seconds. However, install.php loads WordPress by enabling WP_INSTALLING right at the start of the file. During installation, it doesn't write to the database transient; instead, it writes to a memory cache that only lasts for that specific request (if wp_installing() is true, it only calls wp_cache_set).

This leads to two things happening simultaneously:

  1. Since there's no lock in the database, a new cron job is spawned for every single request to install.php.
  2. The spawned wp-cron.php checks the lock in the database against the value attached to its own URL, but since the database is empty, it terminates without running any events.

Since the logs couldn't prove the second point, I ran an experiment. I set up a one-time event scheduled for one second in advance, and then called spawn_cron() while setting wp_installing(true) within PHP.

MODE=install
probe due: yes | wp_installing: true
spawn 0.041s | lock in cache: 1789053973.13… | lock in DB: (none)
1.5s later   | lock in DB: (none) | probe event still scheduled: YES (did not run)

MODE=normal
probe due: yes | wp_installing: false
spawn 0.035s | lock in cache: (none) | lock in DB: 1789053978.40…
1.5s later   | lock in DB: (none) | probe event still scheduled: no (ran)

In installation mode, the lock only stayed in the cache, leaving the database empty. Although the cron calls showed up in the logs, the events themselves weren't actually processed. In normal mode, the lock was applied to the database, and the events disappeared. The 21st call at 4:22 was just a call that completely reloaded WordPress without doing anything, happening every time the scanner hit install.php. The time events actually ran after a regular request came in afterward.

A single empty call is just a PHP execution lasting between 30 and 130ms, so the cost is small. However, out of 934 cron calls on kilho.org, the 54 calls (5.8%) that hit within one second of install.php are almost entirely these empty calls. During the two minutes when the scanner is active, it looks like the cron is running, but in reality, the scheduled tasks are just getting pushed back.

Signs That the Scheduled Time Shifted Without Any Reason

On kilho.org, the scheduled time for time events was around 6:18 PM every hour from August 9th to August 24th. Then, between August 24th and August 27th, it shifted to between 9 PM and 11 PM every hour. WordPress doesn't push back the scheduled time even if it runs late, so this value shouldn't change during normal operation. The only time it changes is when an event disappears and is recreated based on the current time() within the init hook. For network root sites, since the calls weren't clustered near the scheduled time, this method couldn't reliably pin down the scheduled time itself.

I couldn't confirm why the events were disappearing. The entire cron list is serialized under a single cron option, so if two processes read and write at the same time, one change could be overwritten. While it's a possibility since the empty and normal calls overlapped in the same second, there's no trace in the logs, so it remains just a theory.

What I Didn't Fix and Why

Usually, the takeaway for this kind of issue is to enable DISABLE_WP_CRON and have the system cron job call wp-cron.php. I didn't do that this time.

Option What You Gain Why I Didn't Do It On This Server
Switch to System Cron Delay becomes unrelated to requests; eliminates empty calls None of my scheduled posts or automatic updates have ever failed due to delay. No tasks are sensitive to a 15-minute delay.
Block Access to install.php Eliminates 54 empty calls Only needed during reinstallation. The scanner just moves to a different path, and the cron delay remains.
Block xmlrpc.php Security Removing this request, which triggers most cron calls, actually increased the delay. If needed, I'd apply it like the system cron setup.

Instead, I have one guiding principle. If you put tasks on this server that are time-sensitive—like scheduled posts—you should assume they will be delayed not because of low traffic, but because the request reaching WordPress only happens every few minutes. In those cases, you should switch to system cron first. Since this server doesn't have any tasks meeting that criteria right now, I'm leaving things as they are.

Summary of How I Measured It

  • Logs: I parsed all 2,819,012 lines from the access log (/var/log/httpd/access_log) across four rotations, covering August 9, 2026, 00:00 to September 11, 2026, 00:03, using Python for full parsing.
  • Identifying Cron Calls: I looked for POST /wp-cron.php?doing_wp_cron=… originating from the server's own IP, specifically those with a User Agent starting with WordPress/. I excluded the 463 requests hitting wp-cron.php from external IPs.
  • Measuring Delay: I estimated the scheduled time by finding the start of the busiest two-minute window within each three-day period (down to 10-second increments). The delay was measured in seconds from that estimated scheduled time until the first call arrived.
  • Triggering Requests: I only counted a request if there was exactly one non-static request within the one-second window immediately preceding the cron call.
  • Empty Call Experiment: I tested this by creating a one-time event at (scheduled time - 1 second) using wp eval-file, then running spawn_cron() while toggling the wp_installing(true) status. I checked the lock status by directly querying wp_options. I made sure to delete the test event afterward.