WordPress.org

Ready to get started?Download WordPress

Forums

Feature Request : Cache Only Specific Posts (2 posts)

  1. coolkarthik88
    Member
    Posted 6 years ago #

    Hi,

    I have been using Super Cache for a while now. I am on a VPS and my regular traffic levels are easily handled by my server. But at times a few posts of mine get dugg, and I'd like to enable WP-Cache only on those posts.

    Please add this as a feature similar in line to the Rejected URI's. I'd like to enable WP-Cache only for specific posts which i'm expecting to be dugg.

    This is what I tried doing by editing wp cache phase 2 file :

    function wp_cache_is_rejected($uri) {
    	global $cache_rejected_uri;
    
    	if (strstr($uri, '/wp-admin/'))
    		return true; // we don't allow caching of wp-admin for security reasons
    	foreach ($cache_rejected_uri as $expr) {
    		if( preg_match( "~$expr~", $uri ) )
    			return false;
    	}
    	return true;
    }

    And then added the URI of my post into the rejected URI field in the admin. It partially works, It doesn't cache the rest of the blog, but only half of the post is cached

  2. coolkarthik88
    Member
    Posted 6 years ago #

    Hi I've got the above to hack to work. I can now set only specifc posts to be cached using the above mentioned method.

    Please add it as a feature in the future releases..

Topic Closed

This topic has been closed to new replies.

About this Topic