Logo Background

How To Remove W3 Total Cache Comment Footer

  • By on August 4, 2011 | 2 Comments

    W3 Total Cache is one of the best caching plugin in WordPress which improve the blog performance load. Most of the webmaster see their Google Page Speed ranking improve after plugin activation.

    Even after we activate the W3 Total Cache plugin, one of the Google Page Speed recommendation is to Minify HTML.

    Quite strange because W3 Total Cache should minify the HTML as part of the optimization feature.

    When I right click and View Source for the HTML code, I found that there’s comment inserted by W3 Total Cache itself to display the cache performance details.

    <!-- Performance optimized by W3 Total Cache. 
    Learn more: http://www.w3-edge.com/wordpress-plugins/ -->
     
    Minified using disk
    Page Caching using disk (enhanced)
    Database Caching 12/15 queries in 0.009 seconds using disk
    Object Caching 437/473 objects using disk
     
    Served from: www.allguru.net @ 2011-08-02 18:48:14 -->

    Looks like this part of HTML wasn’t minify by W3 Total Cache so I take the chance to remove it.

    The W3 Total Cache comment footer is generated by the ob_callback function which resides in …/wp-content/plugins/w3-total-cache/lib/W3/Plugin/TotalCache.php

    Before:
    if ($this->can_ob()) {
    ob_start(array(
    &$this,
    'ob_callback'
    ));
    }
     
    After:
    if ($this->can_ob()) {
    /*ob_start(array(
    &$this,
    'ob_callback'
    ));*/
    }
     
    Note: The remark on the ob_callback function code will remove the comment footer.

    Clear the cache in W3 Total Cache after the changes. Run the Google Page Speed again and you will see the Minify HTML recommendation is no longer there. Voila!

    Previous
    Next
    » Ultimate GZIP Compression Using .htaccess
  1. #1 Feneo
    May 10, 2012 3:40 am

    Thank you for saving me some time =)

    Post ReplyPost Reply
  1. #2 javier navarro
    May 25, 2012 1:32 am

    Thanks, i was wondering how to delete it. one of my problems with this plugin is not so much the page speed issue, but it is more the injected html comment address to the plugin website creator.

    on the speed issue, i think it is funny that this portion is not compressed. after i deleted it, my yslow and page speed scores went up.

    Thanks, now it is one less problem i have to deal with, now to finish off correcting the free template i am using on my site. the code is horrible 🙁

    Post ReplyPost Reply
Leave a Comment