WordPress.org

Ready to get started?Download WordPress

Forums

W3 Total Cache
[resolved] Page cache not preloading (4 posts)

  1. jeroen-1978
    Member
    Posted 2 years ago #

    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/

  2. astrasuite
    Member
    Posted 2 years ago #

    Thanks, but I can't seEm to find PgCacheAdmin.php. Where is this located ?

  3. jeroen-1978
    Member
    Posted 2 years ago #

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

  4. astrasuite
    Member
    Posted 2 years ago #

    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.

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic