WP-Cache: Preventing from caching the index page

Recently, I’ve been facing some problems with my site, the site is taking a lot of time to load and making the server overload. In order to solve the problem I decided to install the WP-Cache plugin. Though, WordPress already has a very fast structure so that under normal circumstances you will not need this plugin. WP-Cache becomes […]

Recently, I’ve been facing some problems with my site, the site is taking a lot of time to load and making the server overload. In order to solve the problem I decided to install the WP-Cache plugin.

Though, WordPress already has a very fast structure so that under normal circumstances you will not need this plugin. WP-Cache becomes useful if your hosting server is slow, or if your site getting hits from Digg or Slashdot, and providedly, if you want to save bandwidth.

The plugin stores your pages on a static file and serves the visitor requests from that file instead of loading the dynamic pages from the database, improving the responsiveness of the site.

The installation went smooth, and the plugins worked out of the box. However, there’re few issues, as reported by some users on WordPress forum, I’m writing down the solution:

  1. If for some reasons, you want to stop WP-Cache from caching the index page of your blog:
     
    [ Open ] wp-content/plugins/wp-cache/wp-cache-phase2.php file.
    
    [ FIND ] if (strstr($uri, '/wp-admin/')) 
    
    [ REPLACE WITH ] if(strstr($uri,'/wp-admin/') || $uri==='/' || strstr($uri,'/index.php')) 
  2. If after the installation, the plugin serves blank HTML pages. In order to solve this problem:
    • a. You need to locate the WP-Cache folder on your server and open a file called “wp-cache-phase2.php
    • b. Once you open the file search for the function “wp_cache_ob_end”, and look for the line “ob_end_clean();” inside that function.
    • c. Finally just change this line with the following “ob_end_flush();”.

Additional Posts:

WordPress, WordPress Plugins, WP-Cache, WordPress Tricks, WordPress Tips