[Plugin: W3 Total Cache] Page cache not preloading
-
It was annoying to be honest, I use W3 Total Cache with CDN from Amazon and everything was working excellent. My site was as fast as lightning!
A known bug was that the page cache didn’t preload the pages, oké there is a script for it; https://www.pixelenvision.com/1572/php-cache-warmer-preloader-for-w3-total-cache/ but I was hoping the bug would not be to big to solve and I found the problem!
\w3-total-cache\lib\W3\Plugin\PgCacheAdmin.php had already a bug with calling a function that was undefined. It was easily solved by adding a request_once but still the preloading didn’t work.
I found that there were 2 problems;
1 – there is “w3tc_preload=1” added to the URL that did forbid the plugin to cache the site.
2 – In .htaccess there is a default excluding for user-agent ” W3 Total Cache/0.9.2.4 “. This user-agent is also used to create the preloading pages.So the solution?! Find these lines in PgCacheAdmin.php
/** * Make HTTP requests and prime cache */ require_once W3TC_INC_DIR . '/functions/http.php'; foreach ($queue as $url) { $url = w3_url_format($url, array('w3tc_preload' => 1)); w3_http_get($url); }
And replace them by these;
/** * Make HTTP requests and prime cache */ foreach ($queue as $url) { wp_remote_request($url, array('method' => 'GET')); }
For me this is the solution, I’m curious if it also for you!
- The topic ‘[Plugin: W3 Total Cache] Page cache not preloading’ is closed to new replies.