Title: page caching issue
Last modified: March 3, 2022

---

# page caching issue

 *  Resolved [hellothanos](https://wordpress.org/support/users/hellothanos/)
 * (@hellothanos)
 * [4 years, 2 months ago](https://wordpress.org/support/topic/page-caching-issue-4/)
 * Hello,
 * Really enjoying the plugin! I’m running into an issue with cached pages though.
   After I vote the numbers stay the same and I have to clear the cache manually.
   I’m using WP Rocket.
    Is there a way for the cache of the page to be cleared 
   right after the user votes? I’m thinking that if there is a hook, I could do 
   it with php.. but I can’t see any in the docs.
 * Any help would be deeply appreciated!
 * Thanks,
    Thanos

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

 *  Plugin Author [Pixelbart](https://wordpress.org/support/users/pixelbart/)
 * (@pixelbart)
 * [4 years, 2 months ago](https://wordpress.org/support/topic/page-caching-issue-4/#post-15424096)
 * Hello [@hellothanos](https://wordpress.org/support/users/hellothanos/)
 * I’m not a WP-Rocket specialist unfortunately, but you can try the following. 
   Simply in the functions.php or similar:
 *     ```
       apply_filters('helpful_pre_save_vote', 'helpful_rocket_pre_save_vote', 99, 2);
   
       function helpful_rocket_pre_save_vote($response, $post_id)
       {
           $pages_to_clean_preload = [];
   
           $pages_to_clean_preload[] = get_the_permalink($post_id);
   
           if (function_exists('rocket_clean_post')) {
               rocket_clean_post($post_id);
           }
   
           if (function_exists('get_rocket_option')) {
   
               if (1 == get_rocket_option('manual_preload')) {
                   $args = [];
   
                   if (1 == get_rocket_option('cache_webp')) {
                       $args['headers']['Accept'] = 'text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8';
                       $args['headers']['HTTP_ACCEPT'] = 'text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8';
                   }
   
                   helpful_rocket_preload_page($pages_to_clean_preload, $args);
   
                   if (1 == get_rocket_option('do_caching_mobile_files')) {
                       $args['headers']['user-agent'] = 'Mozilla/5.0 (Linux; Android 8.0.0;) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/80.0.3987.132 Mobile Safari/537.36';
                       helpful_rocket_preload_page($pages_to_clean_preload, $args);
                   }
               }
           }
   
           return $response;
       }
   
       function helpful_rocket_preload_page($pages_to_preload, $args)
       {
           foreach ($pages_to_preload as $page_to_preload) {
               wp_remote_get(esc_url_raw($page_to_preload), $args);
           }
       }
       ```
   
 * See: [https://docs.wp-rocket.me/article/494-how-to-clear-cache-via-cron-job](https://docs.wp-rocket.me/article/494-how-to-clear-cache-via-cron-job)
 * Stay healthy!
 * Greetings Kevin
 *  Thread Starter [hellothanos](https://wordpress.org/support/users/hellothanos/)
 * (@hellothanos)
 * [4 years, 2 months ago](https://wordpress.org/support/topic/page-caching-issue-4/#post-15425437)
 * helpful_pre_save_vote was what I was looking for, thank you!
    And thank you for
   the extra effort to suggest the Wp Rocket solution 🙂
 * Best,
    Thanos

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

The topic ‘page caching issue’ is closed to new replies.

 * ![](https://s.w.org/plugins/geopattern-icon/helpful.svg)
 * [Helpful](https://wordpress.org/plugins/helpful/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/helpful/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/helpful/)
 * [Active Topics](https://wordpress.org/support/plugin/helpful/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/helpful/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/helpful/reviews/)

 * 2 replies
 * 2 participants
 * Last reply from: [hellothanos](https://wordpress.org/support/users/hellothanos/)
 * Last activity: [4 years, 2 months ago](https://wordpress.org/support/topic/page-caching-issue-4/#post-15425437)
 * Status: resolved