Talking tech since 2003

I recently ran across the issue after re-enabling WP-Cache on my blog of having my index.php being cached. This was an issue for me because I have my Twitter feed update on my front page and I wanted that to be current when I posted a new tweet. The solution to my problem was relatively simple, yet a bit of a hack job so if anyone knows of a better way to do this feel free to leave a comment.

The first thing you need to do is open your FTP client, connect to your server and navigate to wp-content -> plugins -> wp-cache now you want to download the file wp-cache-phase2.php locally, open your favorite editor and find this piece of code:

function wp_cache_is_rejected($uri) {
global $cache_rejected_uri;

if (strstr($uri, '/wp-admin/'))
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;
}

Replace that with:

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;
}

Obviously this can be applied to any page on your blog.

This worked for me I cannot make any guarantee’s it will work for you, but it should if done properly.

Comments

Sign in or become a BestTechie member to join the conversation.
Just enter your email below to get a log in link.

Subscribe to BestTechie Plus

You've successfully subscribed to BestTechie
Welcome back! You've successfully signed in.
Great! You've successfully signed up.
Your link has expired
Success! Your account is fully activated, you now have access to all content.