A WordPress index page shouldn't be cached by wp-cache the same as posts or other pages not as frequently updated. This 30 second fix gives you control to not cache / or /index.php on your blog. You can use this hack to disable caching anything you want.

Table of Contents

  1. Introduction
    1. Disable caching specific URI's
    2. WP-Cache Links
    3. Attached Files
      1. Modified wp_cache_is_rejected function
    4. About WP-Cache Caching Plugin
      1. Wp-Cache uses 2 phases

Disable caching specific URI's

First clear the cache from the WP-Cache Options Page. Then modify the wp_cache_is_rejected function.

  1. [ PRESS ] Delete cache on the WP-Cache Options Page
  2. [ OPEN ] wp-content/plugins/wp-cache/wp-cache-phase2.php
  3. [ FIND ] if (strstr($uri, '/wp-admin/'))
  4. [ REPLACE WITH ] if(strstr($uri,'/wp-admin/') || $uri==='/' || strstr($uri,'/index.php'))

NOTE: If anyone comes up with an improvement to this technique or a different/better implementation, please let me know so we can help with the development of an updated WP-Cache plugin!

WP-Cache Links

A WordPress index page shouldn't be cached by wp-cache the same as
posts or other pages not as frequently updated. This 30 second fix gives you control to not cache / or /index.php on your blog. You can use this hack to disable caching
anything you want.

  • Author Homepage
  • Author Homepage
  • Author Homepage
  • WP-Cache on WordPress.org

Attached Files

  1. WP-Cache Version 2.1.1

Modified wp_cache_is_rejected function

function wp_cache_is_rejected($uri) {
	global $cache_rejected_uri;

	if(strstr($uri,'/wp-admin/') || $uri==='/' || strstr($uri,'/index.php'))
		return true; //we don't allow cacheing wp-admin for security
	foreach ($cache_rejected_uri as $expr) {
		if (strlen($expr) > 0 && strstr($uri, $expr))
			return true;
	}
	return false;
}

About WP-Cache Caching Plugin

WP-Cache works by caching WordPress pages and storing them in a static file for serving future requests directly from the file rather than loading and compiling the whole PHP code and the building the page from the database...

Wp-Cache uses 2 phases

The first is called at the very begining wp-cache-phase1.php when just few code has been compiled. The second wp-cache-phase2.php after all plugins have been executed. The first phase checks if the requested URL is already cached, if so it serves from the static file and finishes. The second phase stores the generated page in a static file for further request.

Prevent WP-Cache from Caching index - AskApache

Charles Torvalds
7 Dec 2007

  • Site Map WireShark GNU Non-GNU Tor Project cURL TLDP - Documentation
  • Htaccess Files Hacking Htaccess Javascript Linux Optimization PHP Security Shell Scripting WordPress
  • Base64 Image Converter Raw HTTP Header Debugger Graphical ASCII Text Generator Mac Address Vendor Lookup Who Am I – Your IP Information Request Method Security Scanner .htpasswd file Generator Compress CSS DNS Tracer
Copyright © 2025 AskApache
  • Site Map
  • Htaccess Files
  • Hacking
  • Htaccess
  • Javascript
  • Linux
  • Optimization
  • PHP
  • Security
  • Shell Scripting
  • WordPress
  • Base64 Image Converter
  • Raw HTTP Header Debugger
  • Graphical ASCII Text Generator
  • Mac Address Vendor Lookup
  • Who Am I – Your IP Information
  • Request Method Security Scanner
  • .htpasswd file Generator
  • Compress CSS
  • DNS Tracer
Exit mobile version