Title: hooks
Last modified: February 27, 2022

---

# hooks

 *  Resolved [dg78](https://wordpress.org/support/users/dg78/)
 * (@dg78)
 * [4 years, 5 months ago](https://wordpress.org/support/topic/hooks-37/)
 * 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)

 *  [Harshad](https://wordpress.org/support/users/bornforphp/)
 * (@bornforphp)
 * [4 years, 5 months ago](https://wordpress.org/support/topic/hooks-37/#post-15413412)
 * [@dg78](https://wordpress.org/support/users/dg78/) You can use `wpo_pre_cache_buffer`
   hook 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](https://wordpress.org/support/users/dg78/)
 * (@dg78)
 * [4 years, 5 months ago](https://wordpress.org/support/topic/hooks-37/#post-15415678)
 * 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](https://wordpress.org/support/users/dg78/)
 * (@dg78)
 * [4 years, 5 months ago](https://wordpress.org/support/topic/hooks-37/#post-15416754)
 * 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.

 * ![](https://ps.w.org/wp-optimize/assets/icon-256x256.png?rev=1552899)
 * [WP-Optimize – Cache, Compress images, Minify & Clean database to boost page speed & performance](https://wordpress.org/plugins/wp-optimize/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/wp-optimize/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/wp-optimize/)
 * [Active Topics](https://wordpress.org/support/plugin/wp-optimize/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/wp-optimize/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/wp-optimize/reviews/)

 * 3 replies
 * 2 participants
 * Last reply from: [dg78](https://wordpress.org/support/users/dg78/)
 * Last activity: [4 years, 5 months ago](https://wordpress.org/support/topic/hooks-37/#post-15416754)
 * Status: resolved