WordPress.org

Support

Support » Plugins and Hacks » W3 Total Cache » [Resolved] [Plugin: W3 Total Cache] Page cache not preloading

[Resolved] [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; http://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!

    http://wordpress.org/extend/plugins/w3-total-cache/

Viewing 3 replies - 1 through 3 (of 3 total)
  • Thanks, but I can’t seEm to find PgCacheAdmin.php. Where is this located ?

    Have a look under wp-content\plugins\w3-total-cache\lib\W3\Plugin\PgCacheAdmin.php

    Thanks, I have tried it, but unfortunately did not work for me. No error in the frontend, but my hosting service reported fatal errors in their error.log.

    Anyway, the cron code in the link you have provided works well for me.

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘[Resolved] [Plugin: W3 Total Cache] Page cache not preloading’ is closed to new replies.
Skip to toolbar