Modify WP-Cache to avoid caching Password Protected Post

This will allow the post to be seen after password is entered correctly.

Changes are made to wp-cache-phase2.php.

function wp_cache_ob_callback($buffer) {

..

/* we avoid caching incomplete files */

if (is_404() || !preg_match('/(<\/html>|<\/rss>|<\/feed>)/i',$buffer) ) {

$new_cache = false;

return $buffer;

}

// dun cache password protect post <-- add here

global $post;

if (is_single() && !empty($post->post_password)) {

$new_cache = false;

return $buffer;

}

Comments

blog comments powered by Disqus