Title: Exclude Count from cache
Last modified: January 27, 2020

---

# Exclude Count from cache

 *  Resolved [Back to Front](https://wordpress.org/support/users/traverser11/)
 * (@traverser11)
 * [6 years, 4 months ago](https://wordpress.org/support/topic/exclude-count-from-cache/)
 * I’m trying to think of an easy way to exclude the counter from my page cache…
   
   We’re using it for a petition counter on the home page, so I don’t want to exclude
   the whole page from the cache. The Siteground optimizer cache plugin we’re using
   has the easy option to exclude js files… So I tried putting the shortcode in 
   a .js file, but then that .js file can’t execute the shortcode, of course…
 * Any pointers in the right direction very appreciated.
 * The page I need help with: _[[log in](https://login.wordpress.org/?redirect_to=https%3A%2F%2Fwordpress.org%2Fsupport%2Ftopic%2Fexclude-count-from-cache%2F%3Foutput_format%3Dmd&locale=en_US)
   to see the link]_

Viewing 1 replies (of 1 total)

 *  Thread Starter [Back to Front](https://wordpress.org/support/users/traverser11/)
 * (@traverser11)
 * [6 years, 4 months ago](https://wordpress.org/support/topic/exclude-count-from-cache/#post-12367726)
 * I guess i fixed this, the long way around?
 * Please let me know if there’s a less roundabout way
 *     ```
       function progressCount(){?>
       <script>
         $progress = <?php echo (do_shortcode('[gravitywp_count formid="1" page_size="100000" thousands_sep=","]'));?>
   
        </script>
        <?php };
   
   
        add_action('wp_head', 'progressCount');
       ```
   
 *     ```
       jQuery(document).ready(function(){
       	// including in js file just so its easy to exclude from cache
   
               jQuery('#petition-count').text($progress);
   
               }
   
               );
       ```
   
    -  This reply was modified 6 years, 4 months ago by [Back to Front](https://wordpress.org/support/users/traverser11/).

Viewing 1 replies (of 1 total)

The topic ‘Exclude Count from cache’ is closed to new replies.

 * ![](https://ps.w.org/gravitywp-count/assets/icon-256x256.jpg?rev=3215193)
 * [GravityWP - Count](https://wordpress.org/plugins/gravitywp-count/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/gravitywp-count/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/gravitywp-count/)
 * [Active Topics](https://wordpress.org/support/plugin/gravitywp-count/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/gravitywp-count/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/gravitywp-count/reviews/)

## Tags

 * [cache](https://wordpress.org/support/topic-tag/cache/)

 * 1 reply
 * 1 participant
 * Last reply from: [Back to Front](https://wordpress.org/support/users/traverser11/)
 * Last activity: [6 years, 4 months ago](https://wordpress.org/support/topic/exclude-count-from-cache/#post-12367726)
 * Status: resolved