WordPress.org

Ready to get started?Download WordPress

Forums

Hyper Cache
[resolved] [closed] Cache invalidation issue - static front page (23 posts)

  1. FolioVision
    Member
    Posted 1 year ago #

    Hello Stefano,

    we found another bug. This applies to sites which have Settings --> Reading --> Front page displays set to "A static page".

    Cache for such page is not cleared when you publish a new blog post. Imagine you have homepage with a featured posts slider and some intro text and then a real blog page on /blog address with a classic list of recent posts.

    Under these conditions, your cache.php sets the front page type "page" instead of "home". The condition

    if (is_home() || is_front_page()) $data['type'] = 'home';

    Needs to be changed to:

    if (is_home() || is_front_page()) $data['type'] = 'home';

    Then the special front page cache is cleared properly when a new blog post is created.

    This is crucial if the cache time is set to full day (your current default I believe) and it's set to only clear the post, homepage and archive cache when a post is published/updated.

    Could you please roll out a quick update version, so we don't have to fix this by hand on a lot of our sites?

    Thanks,
    Martin

    http://wordpress.org/extend/plugins/hyper-cache/

  2. FolioVision
    Member
    Posted 1 year ago #

    Hello all,

    there was a new version one day ago and this was not addressed, so we can't upgrade the plugin on our sites.

    Of course, the original line is just this:

    if (is_home() || is_front_page()) $data['type'] = 'home';

    So the || is_front_page() part is added.

    Thanks,
    Martin

  3. martinjesus
    Member
    Posted 1 year ago #

    Hi there,

    I have my HOME page as a static page on Settings --> Reading. But it is not properly cleared when I do a post modification, although I've done the modification proposed by FolioVision.

    (And Cache invalidation mode -> Only modified post; and "Invalidate home, archives, categories on single post invalidation" is checked).

    Any ideas or help?

    Thanks in advance for your support.
    Jesus

  4. mbrsolution
    Member
    Posted 1 year ago #

    Hello @FolioVision, can you elaborate a bit more what you changed in the code? You typed the following:

    Under these conditions, your cache.php sets the front page type "page" instead of "home". The condition

    if (is_home() || is_front_page()) $data['type'] = 'home';

    Needs to be changed to:

    if (is_home() || is_front_page()) $data['type'] = 'home';

    . What is see is that both codes are identical.

    Kind regards

  5. FolioVision
    Member
    Posted 1 year ago #

    Hello mbrsolution,

    please read my second post. I made a mistake so I corrected it there.

    Hello martinjesus,

    either is_front_page() or is_home() should return true on your home page.

    You should double check if your conditional tags behave properly on your home page, specially if you use a custom page template which pulls in posts from some category, or there might be a conflicting widget too. Both of that might reset your conditional tags and cause the above condition return false.

    Other idea would be to also add is_page( get_option('page_on_front') ). However the goal is to provide an universal fix and is_front_page() should be enough.

    More about conditional tags: http://codex.wordpress.org/Conditional_Tags

    There might be some other bug too. You can even enable Hyper Cache log (you need to uncomment the code in the plugin - look up function hyper_log()) and then add in your own logging to figure out the issue.

    Thanks,
    Martin

  6. mbrsolution
    Member
    Posted 1 year ago #

    Hello @FolioVision, thank you for pointing to the second post. I was not sure that is why I ask. I do apologize for my blindness.

    Kind regards

  7. evo252
    Member
    Posted 1 year ago #

    Thank you so much FolioVision!

  8. evo252
    Member
    Posted 1 year ago #

    Personally, I solved my issue by typing this (if it can help someone that may have a similar template):

    if (is_home() || is_front_page() || is_page_template( 'template-blogall.php' ) ) $data['type'] = 'home';

    Because I'm using a custom page template, and it seems that front_page didn't solved my issue.

  9. mbrsolution
    Member
    Posted 1 year ago #

    Hi, I tested the settings above but in my situation it produces the famous screen of death :) so I had to delete the following entry || is_front_page(). Well I guess I don't need the fix then. But very strange that you apply the fix and nothing happens to both of you.

    Thank you anyhow I am sure someone will use this setting.

  10. martinjesus
    Member
    Posted 1 year ago #

    Hi FolioVision, mbrsolution and evo252,

    First of all, thank you for your responses.

    I've tried with "is_page( get_option('page_on_front') )" and with "is_page_template( 'myownhometemplate.php' ) )", and they do not work for me.

    I will ask my template supplier for the way they identificate the home page, and if I arrive to a solution, I will let you know.

    Thanks to all!

  11. mbrsolution
    Member
    Posted 1 year ago #

    Hello all, just wanted to catch up and find out if your solutions above have been working fine.

    Is there anything else one could add or edit to improve this?

    Kind regards

  12. FolioVision
    Member
    Posted 1 year ago #

    Hello mbrsolution,

    we had no further issues after applying our fix. We do a lot of custom template programming, so if we see any issues next time, we will drop a note in here.

    However is there any Github repository for the plugin? That would make submitting bug fixes more efficient.

    Thanks,
    Martin

  13. mbrsolution
    Member
    Posted 1 year ago #

    Hello Martin, unfortunately I don't know where you could add your fix to unless you ask Stefano Lissa.

    I would like to ask you if you don't mind what are your current settings for this plugin that works best for your website? I am trying to setup the best configuration to improve my website's performance.

    Kind regards

  14. FolioVision
    Member
    Posted 1 year ago #

    Hello mbrsolution,

    we don't really use any special config. If the home page or front page is properly recognized in the plugin (see above fix), then the caching time can be set to 1 full day without any problems.

    We just make sure the theme switching works for the sites which use WPTouch Pro, so we exclude wptouch-pro-view and wptouch_switch_toggle cookies. We also update the list of mobile user agents to match WPTouch Pro.

    Thanks,
    Martin

  15. mbrsolution
    Member
    Posted 1 year ago #

    Hello FolioVision, thank you for your information.

    I use WPTouch but not WPTouch Pro. The problem that I am having is that some pages or post don't get cached correctly and on the PC or laptop browser the mobile view is displayed instead of the normal WordPress theme.

    You mention that you exclude wptouch-pro-view and wptouch_switch_toggle cookies. Where do you enter these code in the plugin to exclude it.

    Kind regards

  16. FolioVision
    Member
    Posted 12 months ago #

    Hello mbrsolution,

    you need to watch out for this when you test caching.

    We have an older article about the mobile site setup process. It's back from days when we used WP Super Cache. I did a quick update to it, just read what's below "If you use Hyper Cache": http://foliovision.com/2011/06/build-mobile-version-website

    Thanks,
    Martin

  17. mbrsolution
    Member
    Posted 12 months ago #

    Hello Martin, thank you very much for your link. I read it and I found it to be very informative. It also helped me with my blogs. I find Hyper Cache to be a very powerful and simple cache plugin.

    I have also posted on Stefano's website in regards to this support thread. I am sure he will look into this and hopefully add an update soon.

    Kind regards

  18. Stefano Lissa
    Member
    Plugin Author

    Posted 11 months ago #

    Hi, sorry if I never replied on this topic. It's right, the is_front_page() must be added. But actually I need to check if the page used as static home page returns a "/" permalink or not, otherwise the invalidation should be wrong. A small issue anyway.

    I promise I'll try to patch the code, it's a busy period... sorry!

    Stefano.

  19. FolioVision
    Member
    Posted 11 months ago #

    Hello Stefano,

    I don't think you totally have to do a thorough check like that. It's more important to make sure the home page is labeled as "home" in $data['type']. And if there is one more page labeled like that, it should not be a problem, only its cache will be cleared more often (when new posts are published).

    So you are right, that would be a small issue compared to what gets fixed.

    Thanks,
    Martin

  20. mbrsolution
    Member
    Posted 11 months ago #

    Hello all, the new update has fixed my issue ;)

    Hello Martin has the new update worked for you?

  21. FolioVision
    Member
    Posted 8 months ago #

    Hello mbrsolution,

    sorry about the delay - we tested this and it works, thank you!

    Martin

  22. mbrsolution
    Member
    Posted 8 months ago #

    Hello Martin,

    Thank you for getting back and it is ok when you are busy you are busy :)

    I just wanted to ask you if you have come across any other improvement to this great plugin?

    Kind regards

  23. FolioVision
    Member
    Posted 8 months ago #

    Hello mbrsolution,

    we will post a new thread if we find any issue.

    Thanks!
    Martin

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic