• Resolved dg78

    (@dg78)


    Hi,

    I use GeneratePress theme and I have two elements (specific to GeneratePress) :

    – the first with two buttons : Register, Login
    hook : after_header_content
    users : disconnected

    – the second with two buttons : Account, Deconnection
    hook : after_header_content
    users : connected

    The website is very slow, so I use the cache of WP-Optimize (my host suggests to use WP-Optimize).

    The website is now fast but when the page comes from the cache then elements don’t update.
    For exemple, the user is connected but the buttons displayed are : Register, Login as if the user is disconnected.

    This happen only when cache plugin is activated. No problem when there is no cache instead it is slow, slow …

    Is there a hook which says « the page is finished and ready from the cache » ?

    I think that, after intercept the event for this hook, it will be to run code for display elements in GeneratePress.

    Thanks

    Dominique

Viewing 3 replies - 1 through 3 (of 3 total)
  • @dg78 You can use wpo_pre_cache_bufferhook to alter content to be cached

    add_filter('wpo_pre_cache_buffer', 'function_to_filter'):
    function function_to_filter($buffer) {
      // alter the $buffer
      return $buffer;
    }

    You may purge cache on wp_login and wp_logout actions

    Since it is header content I think the caches are continuously generated.

    If, All you want to do is to serve different version of cached file for logged in users and logged out users, then you can buy our premium version and enable cache per role option

    Thread Starter dg78

    (@dg78)

    Hi,

    I don’t want enable or disable cache by role (logged in users and logged out users).

    I want always the cache but that it doesn’t do anything with the flag connected / disconnected.
    Some pages are said with logged users and other pages with not logged users.

    It seems as it take the fact logged / not logged that there was when it does the cache.

    If a user is logged, is it possible after the rendering of the page from cache to say to the page that the user is logged ?
    And the same if user is not logged ?

    It is just what I want.`

    Thanks

    Thread Starter dg78

    (@dg78)

    Hi,

    I found the solution.

    There is a checkbox in parameters cache of WP-Optimise.

    I had checked the box : Serve cached pages to logged in users
    It was said : Enable this option if you don’t have user-specific or restricted content on your site.

    I remove the tick and now everything is OK.

    Thanks

Viewing 3 replies - 1 through 3 (of 3 total)

The topic ‘hooks’ is closed to new replies.