PriMoThemes — now s2Member® (official notice)

This is now a very OLD forum system. It's in READ-ONLY mode.
All community interaction now occurs at WP Sharks™. See: new forums @ WP Sharks™

Exclude the homepage from caching

Quick Cache Plugin. Speeds up WordPress®.

Exclude the homepage from caching

Postby Darsch » May 19th, 2011, 6:40 pm

Hello!

Is there a way to exclude from the cache just the homepage? I've got a widget that randomize some stuff, and it would be great if I can avoid caching.
It seems that in the "No-Cache URI Patterns" field there's no way to put the site homepage.

Thanks, regards.
User avatar
Darsch
Registered User
Registered User
 
Posts: 3
Joined: May 19, 2011

Re: Exclude the homepage from caching

Postby julian1828 » May 20th, 2011, 3:26 pm

So this isn't a recommended fix, but it works.

  • Navigate to /wp-content/plugins/quick-cache/includes/templates/handler.tpl.php
  • Insert this at line 80:
    Code: Select all
    else if ($_SERVER["REQUEST_URI"] == "/")
        {
            return; /* Return now. Nothing more to do here. */
        } 
  • Save that.
  • Delete /wp-content/advanced-cache.php (for good measure)
  • Go to the settings for the Quick Cache.
  • Don't make any changes, just re-save the settings. This will recreate the advanced-cache.php file with your new changes.

Suggestion to developers:
I wish there was some filtering abilities on the cache. Such as, in the advanced-cache.php if statement, there should be an else if statement that runs a filter and returned result of the filter decides whether or not to continue. Here is an example of what I am talking about:
Code: Select all
else if (apply_filters ("ws_plugin__qcache_handler_validate", false))
    {
        return;
    } 
(same area as what I said above this section)

So then I would be able to attach a filter to the if statement in the advanced-cache.php. This would be useful for using my own criteria to decide what should be cached. Now I know this is probably a whole solution, as per the cron, etc., but it definitely be an improvement.
User avatar
julian1828
Registered User
Registered User
 
Posts: 2
Joined: May 20, 2011

Re: Exclude the homepage from caching

Postby Darsch » May 20th, 2011, 4:00 pm

Wow, thank you very much!
Why it isn't a recommended fix? This doesn't seems to have any sort of strange side-effect or similar, does it?
User avatar
Darsch
Registered User
Registered User
 
Posts: 3
Joined: May 19, 2011

Re: Exclude the homepage from caching

Postby julian1828 » May 20th, 2011, 4:08 pm

the reason I say it isn't a recommend fix is because I am modifying the plugin. Once they update it, and if you accidentally upgrade it, your changes will be overridden. But no, there aren't any strange side-effects.
User avatar
julian1828
Registered User
Registered User
 
Posts: 2
Joined: May 20, 2011

Re: Exclude the homepage from caching

Postby Darsch » May 20th, 2011, 4:13 pm

Oh ok, well in case of update I'll re-apply the fix (if they'll not add the feature officially). :)
Thanks again.
User avatar
Darsch
Registered User
Registered User
 
Posts: 3
Joined: May 19, 2011

Re: Exclude the homepage from caching

Postby ayman07 » November 8th, 2011, 3:12 pm

this didnt work and caused me to get the white page of death. luckily I managed to fix it. is there another method to doing this?

under the no cache uri you can put links for things that should not be cached. if i just put '/' will that work?
User avatar
ayman07
Registered User
Registered User
 
Posts: 2
Joined: November 8, 2011

Re: Exclude the homepage from caching

Postby doctorproctor » January 6th, 2012, 7:03 pm

Okay, the above fix in handler.tpl.php works for me...ignore this posting for now!

Jim
User avatar
doctorproctor
Registered User
Registered User
 
Posts: 37
Joined: May 18, 2011


Return to Quick Cache Plugin

Who is online

Users browsing this forum: No registered users and 2 guests