In the previous post, I continued troubleshooting an issue where W3 Total Cache page cache entries rarely lasted more than 2 days.
Eventually, I first identified a chain of failures that had been ongoing for some time:
Yoast post-sitemap.xml
↓
PHP-FPM 256M memory exhausted
↓
HTTP 500
↓
Joint Sitemap preheating failing for an extended period
↓
W3TC unable to consistently obtain the latest preheated URLsAfter increasing the PHP-FPM memory_limit from the effective 256M to 512M, both the Chinese and English post-sitemap.xml returned HTTP 200, and the joint Sitemap resumed automatic updates.
At this point, I originally thought the W3TC page cache preheating issue was essentially resolved.
But upon further inspection, I discovered an even stranger problem:
Although the Prime and Cleanup cron tasks in W3 Total Cache were configured, they were not executing properly. After manually recreating them, the tasks would even disappear again.
Continuing the investigation, I ultimately reproduced a set of highly critical results:
cron option in the database: YES
WordPress get_option("cron"): NOThat means:
The Cron data saved in MySQL was already the new version, but what a normal PHP environment read from the Object Cache was still an old copy.
Finally, by precisely deleting options/alloptions in the Redis Object Cache, the Cron data became consistent again.
This post documents the entire troubleshooting process.
1. Sitemap Restored, but W3TC Prime Still Not Working Properly
W3 Total Cache currently has Page Cache Preload enabled.
The configuration is roughly as follows:
Page Cache: Disk Enhanced
Prime:
Execute every 300 seconds
Preheat 7 URLs each time
Cleanup:
Execute every 3600 secondsThe two corresponding WP-Cron Events are:
w3_pgcache_prime
w3_pgcache_cleanupAfter the joint Sitemap was restored, I started verifying whether these two tasks were actually running properly.
I found that their status was clearly incorrect.
After recreating them, WP-CLI showed:
w3_pgcache_prime
2026-09-01 04:09:28
now
5 minutes
w3_pgcache_cleanup
2026-09-01 04:09:28
now
1 hour
The time shown here is GMT.
In Beijing time, that corresponds to:
12:09:28The Prime interval is 5 minutes, and the Cleanup interval is 1 hour.
Under normal circumstances, as long as WP-Cron actually executes once, the next execution time for both tasks should advance accordingly.
But that was not the case.
2. Linux Cron Has Been Executing wp-cron.php All Along
My WordPress has disabled automatic WP-Cron triggering via frontend access:
DISABLE_WP_CRON = trueThe server uses Linux Cron to directly execute the following every 5 minutes:
*/5 * * * * cd /data/wwwroot/www.shuijingwanwq.com && /usr/local/php/bin/php wp-cron.php >/dev/null 2>&1So the theoretical chain is:
Linux crond
↓
php wp-cron.php
↓
WordPress WP-Cron
↓
w3_pgcache_prime
w3_pgcache_cleanupAfter checking /var/log/cron, I could also confirm that wp-cron.php was indeed executing every 5 minutes.
So the problem was not:
Linux Cron not starting.
Even executing it manually:
/usr/local/php/bin/php wp-cron.phpalso returned normally:
exit_code=0But at that time, the times for the two W3TC Events still did not advance as expected.
So the problem had to be traced further inside WordPress Cron.
3. First Ruling Out the Most Common WP-Cron Issues One by One
Next, I checked a few of the most direct possibilities.
First, I confirmed:
wp_get_ready_cron_jobs()I could see:
w3_pgcache_prime
w3_pgcache_cleanupThis means WordPress clearly determined that they had reached their execution time.
Checking further:
has_action("w3_pgcache_prime")
has_action("w3_pgcache_cleanup")Both had also registered their callbacks.
At the same time:
get_transient("doing_cron")No long-lingering Cron lock was found.
Therefore, I gradually ruled out:
Task does not exist at all ×
Task has not reached its time yet ×
W3TC callback not registered ×
Long-term doing_cron lock stuck ×
Linux crond not running ×At this point, the problem was already somewhat unusual.
4. Even Stranger, the Two W3TC Events Later Disappeared Directly from the Database
Upon further inspection, a phenomenon even stranger than “not executing” occurred.
Reading directly from the WordPress database:
wp_options
option_name = cronI found:
w3_pgcache_prime:NOT IN DATABASE
w3_pgcache_cleanup:NOT IN DATABASEThat is to say:
The two W3TC Cron Events that had just been successfully created later actually disappeared from the real database.
If it were merely a W3TC Prime callback execution failure, it would be theoretically difficult to explain this phenomenon.
At this point, I began to suspect:
Could it be that a specific Event was not individually deleted, but rather the entire
cronoption had been overwritten by an old copy of data?
To verify this hypothesis, I needed an experimental task completely unrelated to W3TC.
5. Creating a Probe That WordPress Plugins Do Not Recognize at All
I first created a temporary Cron Event:
swq_cron_persist_probeAnd scheduled its execution for about 1 hour later.
This name was generated temporarily; no existing plugin could have possibly written deletion logic for it in advance.
After creating it, I checked:
schedule_result=bool(true)
DB_contains_probe=YES
get_option_contains_probe=YESThis showed that the task had indeed been written to the database.
I then immediately executed:
/usr/local/php/bin/php wp-cron.phpNote:
This Probe was still about 1 hour away from expiring, so
wp-cron.phpat this point should not have processed it at all.
But after executing it, I checked again:
DB_contains_probe=NO
get_option_contains_probe=NO
next_scheduled=bool(false)The Probe had unexpectedly disappeared.
This basically ruled out:
W3TC itself specifically clearing
w3_pgcache_prime.
Because an Event with a temporarily generated name that had not yet expired also disappeared.
The real suspect became:
wp-cron.php starts
↓
Reads the old Cron array
↓
Executes a due Event
↓
Writes the cron option back
↓
Newly added Events are overwritten by the old arrayHowever, this still needed further proof:
Did WordPress actually read an old copy of Cron data?
6. Key Evidence Emerges: DB=YES, but get_option=NO
So I set up a second Probe:
swq_cron_persist_probe_2This time, I scheduled it for about 2 hours later.
After creating it, I queried the database directly:
schedule=bool(true)
DB=YESThis showed that the Event already existed in the database.
I then started a brand-new normal PHP process and read it via WordPress:
get_option("cron")The result was:
get_option=NO
DB=YES
This set of results was crucial.
Because at the same point in time:
MySQL:
Probe = YES
WordPress get_option("cron"):
Probe = NOIt could no longer be explained by “the task was not created successfully.”
The database clearly had the new data.
But the WordPress API was reading the old data.
Further checking in:
define("DOING_CRON", true);yielded the same result:
get_option=NO
DB=YESTherefore, the problem was also not simply:
Only the WP-Cron environment could not see the tasks.
More accurately, the option data obtained by the new normal PHP process was already inconsistent with the database.
7. Shifting Attention to W3TC Redis Object Cache
WordPress currently has W3 Total Cache Object Cache enabled:
Object Cache:Enabled
Engine:RedisAnd WordPress’s:
cronis an autoload option.
Checking the database yielded:
autoload=onThis means it is usually loaded along with a large number of autoloaded options into:
alloptionsTherefore:
get_option("cron")It does not necessarily query MySQL directly every time.
In an environment with a persistent Object Cache enabled, it likely reads the cached:
group:options
key:alloptionsAt this point, the previous phenomena had a very reasonable explanation:
cron in the database
has been updated
↓
alloptions in Redis
is still the old version
↓
new PHP process
get_option("cron")
↓
gets old dataBut a guess was not enough, so the next step was to verify it directly.
8. Precisely Deleting alloptions Instead of Flushing All Cache
Here, I did not execute:
W3TC Flush AllNor did I clear the Page Cache.
Because the entire troubleshooting effort was originally to figure out the abnormal page cache lifecycle issue; flushing all page cache at this point would instead disrupt subsequent observations.
So I only targeted:
options / alloptionsfor minimal-scope handling.
Initially, after deleting it via WP-CLI, an interesting situation occurred:
alloptions=bool(true)But the new normal PHP process still showed:
get_option=NO
DB=YESThis indicated that in the current environment:
There is a discrepancy between the actual observation results of Object Cache in WP-CLI versus normal PHP.
Therefore, I later switched to executing in the same normal PHP environment as wp-cron.php:
wp_cache_delete("alloptions", "options");The result:
delete_alloptions=bool(true)Immediately after, I started a new normal PHP process to read it again.
This time, it changed to:
get_option=YES
DB=YES
This before-and-after comparison was very direct:
Before deletion:
get_option=NO
DB=YES
↓
Delete alloptions
↓
After deletion:
get_option=YES
DB=YESTherefore, at this point, it was fairly clear to confirm:
The direct failure mechanism for the disappearance of WP-Cron Events this time is related to the stale
alloptionsObject Cache.
9. Why Does a Stale alloptions Cause Future Events to Disappear as Well?
All WordPress Cron tasks are essentially stored in:
option_name = cronThis structured data.
If the database already contains:
Cron Version BWhich includes:
Old tasks
+
Newly added W3TC Prime
+
Newly added Cleanup
+
ProbeBut a certain PHP process still retrieves from the Redis Object Cache:
Cron Version AWhich only contains:
Old tasksThen, when this process executes a due task and triggers:
wp_reschedule_event()or:
wp_unschedule_event()it may write the old array it holds back to the database.
Consequently:
Database Version B
↓
Overwritten again by Version A
↓
All newly added Events disappearThis also explains the previous most abnormal phenomenon:
Why a Probe scheduled to run in 1 or 2 hours would also disappear prematurely after running
wp-cron.php.
It was not “executed” by Cron.
It was more likely:
The new version of Cron data containing it was entirely overwritten by the old version.
10. Re-establishing Prime, Cleanup, and the Probe
After cleaning up the stale alloptions, I recreated:
w3_pgcache_prime
w3_pgcache_cleanupAnd retained:
swq_cron_persist_probe_2for continued verification.
Subsequent database checks showed:
DB w3_pgcache_prime=YES
DB w3_pgcache_cleanup=YES
DB swq_cron_persist_probe_2=YES
Because of the limited display space in the terminal, the screenshot does not fully include the preceding creation commands.
However, what really needs to be confirmed here is the final database state:
Prime = YES
Cleanup = YES
Probe = YESThis indicated that all three Events now existed simultaneously.
I also checked their execution times:
w3_pgcache_prime
05:39:35 GMT
w3_pgcache_cleanup
05:39:35 GMT
swq_cron_persist_probe_2
07:34:18 GMTPrime and Cleanup had already expired, while the Probe was still nearly two hours away from executing.
This was perfect for testing wp-cron.php again.
11. Executing wp-cron.php Again—This Time It Finally Worked
After executing:
/usr/local/php/bin/php wp-cron.phpI checked again.
Prime went from:
05:39:35 GMTto:
05:44:35 GMTExactly:
+5 minutesCleanup went from:
05:39:35 GMTto:
06:39:35 GMTExactly:
+1 hourAnd the Probe:
07:34:18 GMTremained completely unchanged.
In the database:
DB w3_pgcache_prime=YES
DB w3_pgcache_cleanup=YES
DB swq_cron_persist_probe_2=YESalso all continued to exist.

The results this time formed a stark contrast with the failure state.
Before the fix:
Execute wp-cron.php
↓
Future Probe disappearsAfter the fix:
Execute wp-cron.php
↓
Prime +5 minutes
Cleanup +1 hour
Probe unchangedAt this point, the manual testing had formed a closed loop.
12. Finally, I Needed to Prove That System Cron Also Works Properly
Manual execution working was not enough.
The production environment actually relies on Linux crond:
*/5 * * * *So in the end, I did not manually execute wp-cron.php again; instead, I waited for the next system Cron.
At 13:45:01, /var/log/cron clearly showed:
Sep 1 13:45:01 ...
/usr/local/php/bin/php wp-cron.php
Due to the limited terminal display space, this screenshot only retained the actual execution record of the system Cron.
Subsequently, I continued checking the W3TC Event status. Prime had automatically advanced from the previous:
05:44:35 GMTto:
05:49:35 GMTWhile the not-yet-due Cleanup still remained at:
06:39:35 GMTThis meant that the real production chain was also restored:
Linux crond
↓
php wp-cron.php
↓
WordPress Cron
↓
w3_pgcache_prime
↓
Next execution time +5 minutesSo ultimately, it was not:
Only working properly with manual execution.
The real Cron running every 5 minutes on the system was also able to drive W3TC Prime properly.
13. What Can Be Definitively Confirmed This Time?
Through this round of testing, several conclusions became fairly clear.
1. Linux crond Is Not Broken
The logs consistently showed:
Executing wp-cron.php every 5 minutesAfter the fix was completed, the same Cron configuration indeed allowed Prime to advance automatically.
So there was no need to modify Linux Cron.
2. wp-cron.php Itself Is Also Not Broken
During the failure:
php wp-cron.phpAlthough it returned:
exit_code=0its behavior was abnormal.
After cleaning up the stale alloptions, the exact same:
php wp-cron.phpimmediately returned to normal.
So the problem was not with the wp-cron.php file itself.
3. W3TC Prime / Cleanup Callback Itself Is Not Broken
After restoring consistency:
Prime +5 minutes
Cleanup +1 hourBoth perfectly matched the current W3TC configuration.
Therefore, there was also no need to modify the Prime callback.
4. The Direct Failure Mechanism Has Been Located at Stale alloptions
The most critical test result remains:
DB=YES
get_option=NOSubsequently:
delete alloptionsImmediately changed it to:
DB=YES
get_option=YESThis is the most important set of evidence in the entire troubleshooting process.
14. But the Deepest Root Cause Is Not Fully Resolved Yet
Here, two concepts need to be distinguished:
Finding the direct failure mechanism does not mean the deepest root cause has been found.
We now know:
alloptions in the normal PHP environment
had stale dataBut it is not yet fully explained:
Why was the autoload option in the database updated, but this Redis Object Cache was not synchronously invalidated?
My WordPress environment is also somewhat special.
It currently involves at least:
www.shuijingwanwq.com
en.shuijingwanwq.com
admin.shuijingwanwq.comThe backend is primarily accessed via:
admin.shuijingwanwq.comwhile using Polylang to manage Chinese and English content.
Previously, to handle caching issues between Polylang and W3 Total Cache in a multi-domain environment, I had already added an MU Plugin.
But from this situation:
The existing compatibility handling may not have covered the complete multi-domain cache consistency issue.
However, it is not yet possible to directly assert:
admin domain
↓
causes stale alloptionsBecause I still need to confirm:
- Whether the Redis namespace used by WP-CLI and normal PHP is exactly the same;
- Whether the Object Cache keys are truly identical across the three Hosts:
admin,www, anden; - Whether W3TC applies special Object Cache handling for WP-CLI;
- Which Page Cache / Object Cache scenarios the current MU Plugin actually handles.
This part is more suitable for a separate investigation in the future.
15. Page Cache and Object Cache Must Not Be Confused
This troubleshooting also made me realize one point more clearly:
W3TC Page Cacheand:
W3TC Object CacheAlthough both are called “cache,” they are actually two completely different issues.
Page Cache currently uses:
Disk EnhancedIt primarily caches the final HTML pages.
But what affected WP-Cron this time:
alloptionsbelongs to:
Object Cache / RedisSo just because a data consistency issue occurred in the Object Cache, one cannot directly assume:
W3TC’s page file cache must also be broken.
The same is true in reverse.
Next, observing whether the:
4-day Page Cache TTLcan finally start to gradually produce cache files lasting 2 days, 3 days, or even close to 4 days still needs to be done separately.
16. Why Didn’t I Just Flush All This Time?
Throughout the process, I tried to avoid:
W3TC Flush AllThe reason is simple.
This server only has 2 vCPUs, and this issue was originally revisited because of a CPU alert.
If I directly cleared all page caches, a large number of pages would need to be regenerated immediately, which could instead create a new wave of cache rebuild pressure.
Moreover, this time I was able to precisely narrow the problem down to:
options / alloptionsSo the most reasonable approach was:
Only handle the truly abnormal cacherather than:
Clearing all caches just for convenienceUltimately, it was indeed proven that handling just alloptions was sufficient to restore Cron data consistency.
17. Standardize WordPress Operations in the Server Terminal on WP-CLI Going Forward
To locate the problem this time, I alternated between using:
WP-CLI
Normal PHP CLI
wp-cron.php
Direct database queriesThis was necessary for fault diagnosis.
Especially if I had not deliberately compared:
WP-CLI
vs
Normal PHPI might not have discovered the discrepancy:
DB=YES
get_option=NOHowever, mixing them like this for daily operations over the long term will increase comprehension costs.
Therefore, I plan to generally follow one principle going forward:
Daily WordPress management in the server terminal
→ Prioritize WP-CLI
When needing to verify the real execution environment of Web / PHP / WP-Cron
→ Only then temporarily use normal PHPAs for the current system Cron:
/usr/local/php/bin/php wp-cron.phpI do not plan to change it to:
wp cron event run --due-nowfor the sake of “formal consistency” for the time being.
Because the existing production chain has already been verified in practice:
Linux crond
→ php wp-cron.php
→ W3TC PrimeIt is currently running normally.
Until the Object Cache discrepancy between WP-CLI and normal PHP is fully investigated, there is no need to additionally change a production entry point that is already working properly.
18. Three Layers of Issues Finally Unraveled Step by Step
Looking back at this CPU alert, it ultimately unraveled into three completely different layers of problems.
The first layer was the traffic entry point:
Large volume of abnormal access in a short period
↓
EdgeOne
↓
Adaptive rate limiting
JavaScript Challenge
Anti-scraping traffic controlThe second layer was the page preheating entry point:
Yoast post-sitemap.xml
↓
256M OOM
↓
HTTP 500
↓
Joint Sitemap unable to update for an extended periodThe third layer was WordPress Cron and Object Cache:
cron option has been updated
↓
Redis alloptions still stale
↓
get_option("cron") reads old value
↓
wp-cron.php works with old Cron data
↓
Newly created Events are overwrittenWhen these three issues overlapped, it was easy to feel:
W3TC seems to be abnormal everywhere.
But after truly unraveling them layer by layer, each layer could actually be verified independently.
This was also the most valuable part of this troubleshooting.
19. Observe First Going Forward, No More Major Configuration Changes
W3TC Prime has now been restored to:
Every 5 minutes
Preheat 7 URLsCleanup:
Every 1 hourThe joint Sitemap has also resumed continuous updates.
The Page Cache lifecycle remains:
4 daysThe more important thing right now is not to continue adjusting parameters, but to let the system run stably for a while.
If the cache directory gradually starts showing page caches from:
1 day
2 days
3 daysit will mean that the original question:
Why does a 4-day TTL rarely show page cache lasting more than 2 days?
has finally begun to be verified in practice.
As for why the alloptions inconsistency occurred this time between the multi-domain setup, Polylang, admin.shuijingwanwq.com, WP-CLI, and W3TC Redis Object Cache, that can serve as an independent issue for the next round of troubleshooting.
At least for now, the three issues unearthed from this CPU alert have finally all reached a fairly clear resolution.
