All ArticlesHosting2026-11-25T02:29:20+08:00

Thinking wp-cron Runs on a Real Schedule? Check Access Logs for wp-cron.php Hits

Scheduled posts, backups, or emails fire late or bunch together because wp-cron only runs when a visitor loads a page, not at fixed times. Readers will learn to read wp-cron.php requests in the access log to confirm this behavior and decide when to replace it with a system cron job.

Many site owners assume that when a post is scheduled for 09:00 or a backup plugin says "daily at 02:00", something on the server wakes up at that minute and runs the job. With WordPress's built-in scheduler, called WP-Cron, that isn't what happens. A task runs only when some request reaches WordPress and WordPress notices the task is overdue. The access log shows this clearly once you know which line to look for.

What WP-Cron does on each page load

WordPress keeps its list of scheduled events in the cron option inside the wp_options table. Each event has a timestamp and, for repeating events, an interval such as hourly or daily.

On a normal page request, WordPress checks that list. If any event's timestamp is in the past, it sends a loopback request, which is an HTTP request from the server to its own /wp-cron.php. That request carries a doing_wp_cron query parameter holding a timestamp. The request is non-blocking, so the visitor's page doesn't wait for the tasks to finish. A short-lived lock, stored as a transient and controlled by the WP_CRON_LOCK_TIMEOUT constant (60 seconds by default), stops a second spawn from starting while one is in progress.

The consequence is that a WP-Cron schedule means "not before this time". If nobody visits between 02:00 and 07:40, the 02:00 backup runs at 07:40. An hourly event runs at most once an hour, and only if a request arrives to trigger it. Nothing in this design reads the system clock on its own.

On a quiet site the result shows up as late or missed tasks. The Missed Schedule article covers that symptom in detail. The rest of this article is about confirming the behavior from logs and deciding what to replace it with.

Finding wp-cron.php hits in the access log

The access log records every request the web server handles, including the loopback calls WordPress makes to itself. Where the log lives depends on the setup. Nginx often writes to /var/log/nginx/access.log, Apache on Debian and Ubuntu to /var/log/apache2/access.log, and cPanel servers keep per-domain logs in a domlogs directory whose path varies by version. A site may also have its own vhost log, so check the server block or virtual host config if the main log looks empty.

Once you know the file, two read-only commands give most of the picture. The first shows the most recent hits. The second counts hits per hour, which makes gaps and bursts easy to see. It assumes the common combined log format, where the fourth field is the timestamp.

# Last 20 wp-cron.php requests
grep 'wp-cron.php' /var/log/nginx/access.log | tail -n 20

# Hits per hour, e.g. '[24/Nov/2026:18'
grep 'wp-cron.php' /var/log/nginx/access.log | awk '{print $4}' | cut -d: -f1-2 | sort | uniq -c

A typical loopback hit looks like this:

Illustrative output format:
203.0.113.10 - - [24/Nov/2026:18:30:04 +0000] "POST /wp-cron.php?doing_wp_cron=1795545004.1234560680389404296875 HTTP/1.1" 200 0 "-" "WordPress/<version>; https://example.com"

Read it left to right. The source IP is usually the server's own address, because the server is calling itself. Depending on DNS and any proxy in front, it may also be 127.0.0.1 or a proxy address. The method is POST and the status is 200. The doing_wp_cron value is a Unix timestamp; this one decodes to the same second as the log time. The user agent names WordPress and the site URL.

If you see GET requests to wp-cron.php from other IPs with other user agents, something outside WordPress is calling it. That might be an uptime monitor, an external cron service someone set up, or a scanner probing the file. Those are worth identifying before you change anything.

Reading the pattern behind late or bunched tasks

The per-hour counts usually fall into one of a few shapes, and each one points to a different cause.

Gaps that line up with quiet hours. No hits overnight, then hits resume when visitors come back in the morning. This is WP-Cron working as designed on a low-traffic site. Anything scheduled during the gap runs late.

One hit after a long gap, then a burst of activity. When a request finally arrives, a single spawn processes every overdue event in sequence. Backups, cache purges, and queued emails that should have been spread across the night all run within the same few minutes. This is the "emails arrive in a batch" symptom, and it can also spike CPU and database load at a random time of day.

Steady traffic but no hits at all. This one confuses people the most, because the site is clearly busy. There are two usual causes. A full-page cache (a caching plugin, a server-level cache, a reverse proxy, or a CDN) may be serving pages without ever running PHP, and WP-Cron can't spawn if WordPress never loads. Whether cached views trigger WP-Cron depends on how the cache is set up. The other cause is a failing loopback. A firewall may block the server from connecting to itself, a staging site may sit behind HTTP authentication, or the domain may resolve to a CDN or an old server. The Site Health screen in the WordPress admin includes a loopback test that often catches this.

Hits close to every minute. On a busy, uncached site, WP-Cron can spawn as often as the lock allows. Each spawn boots a full WordPress request and occupies a PHP worker, even when there's little to do. That's wasted capacity during peak traffic.

Errors or timeouts on the hits. Status codes like 499, 502, 504, or 500 on wp-cron.php mean tasks are failing or being cut off. Check the PHP error log at the same timestamps.

On a support desk, the first check for a "my scheduled post didn't publish" report is usually simple: does wp-cron.php appear in the log around the scheduled time at all? That one check separates "no trigger" from "trigger fired but the task failed", which need different fixes.

Replacing the page-load trigger with a system cron job

The production pattern is to stop WordPress from spawning cron on page loads and let the operating system's cron daemon call it on a fixed interval instead. This happens in two steps.

  1. In wp-config.php, above the line that says to stop editing, add define( 'DISABLE_WP_CRON', true );. This turns off the page-load check only. Scheduled events still exist and still run when something calls them.
  2. Add a crontab entry for the site's user, not root, so files created by tasks keep the right ownership. Use crontab -e as that user.

With WP-CLI installed, the cleanest entry runs due events directly through PHP:

# Run due WordPress cron events every 5 minutes
*/5 * * * * cd /home/USER/public_html && /usr/local/bin/wp cron event run --due-now >/dev/null 2>&1

Replace the path and user with your own. Cron runs with a minimal PATH, so use the full path to wp (check it with which wp). If WP-CLI isn't available, two alternatives are running php wp-cron.php from the site directory, or requesting the URL with curl or wget. The HTTP approach goes through the web server and is subject to its timeouts. The CLI approaches aren't.

The interval is a trade-off. Every 5 minutes keeps scheduled posts and emails close to on time. Every 15 minutes is lighter on a server with many sites. For a store or a membership site, shorter is usually worth it. For a brochure site, 15 minutes is typically fine. If some tasks can run longer than the interval, wrap the command in flock -n with a lock file so two runs don't overlap.

The default WP-Cron is still reasonable for some sites. A personal blog with steady daytime traffic, nothing time-sensitive, and no shell or cron access can live with it. Switch when lateness has a real cost, such as order emails, subscription renewals, or backups, or when the logs show either gaps or constant spawning.

Confirming the switch worked

After the change, the access log pattern changes in a way that can look alarming. With the WP-CLI or php approach, the POST hits with the WordPress user agent stop, and nothing replaces them. Those commands never go through the web server, so they don't appear in the access log. That silence is expected.

To confirm tasks are running, run wp cron event list and check that the next-run times keep moving forward instead of piling up in the past. If you chose the curl approach, you should see regular GET hits every 5 or 15 minutes with the curl user agent. The system cron verification article walks through tracing executions when a cron job fails silently.

The practical rule is to look at the log before trusting the schedule. A one-line grep for wp-cron.php tells you whether WordPress is being triggered, how often, and whether those runs succeed. If the hits follow your visitors rather than the clock, and the timing matters for the site, disable the page-load trigger and give the job to system cron.