October 25, 2022: Added support for enabling Cache Buster globally with form-specific exclusions.
July 21, 2022: Added support for using Cache Buster with WPML!
April 20, 2022: Added support for using Cache Buster with Nested Forms!
November 23, 2021: Fixed an issue where Save & Continue links generated by a form using Cache Buster would not be correct.
April 27, 2021: Fixed an issue with GF 2.5 and default Checkbox fields values.
April 13, 2021: Fixed a compatibility issue with GPPA.
March 18, 2021: Fixed parsing of
title
anddescription
boolean values in shortcodes.March 15, 2021: Fixed an issue where Cache Buster would not display a form's title.
October 1, 2020: Migrated snippet to the Snippet Library.
September 14, 2020: Added support for passing URL parameters.
Overview
I think if there’s one thing everyone in the WordPress community agrees on, it’s this: caching is awesome. It improves the performance of your site and reduces the bandwidth required to load pages and files. WordPress-specific hosting providers typically cache pages by default, and if you’re managing your own server you can add any number of plugins, such as WP Super Cache, W3 Total Cache, and many more that can immediately improve page load times. If you aren’t taking advantage of caching on your site, you should.
If you use caching on your site, you should know that it can sometimes cause unexpected side effects with Gravity Forms. This can be further compounded when using our Perks, like Populate Anything, Nested Forms, and Limit Choices. To avoid this, it is recommended to bypass the cache on Gravity Forms with dynamic features.
One solution for this is to simply exclude those pages from the cache, but you lose the benefits of page caching. A better solution is to only bypass the cache for the form itself, and we cooked up a Cache Buster plugin to do just that.
It loads the form via AJAX (not to be confused with submitting the form via AJAX), bypassing the WordPress cache for the form only. This allows the page cache, and the performance boost that goes with it, to remain intact.
Using the Plugin
Prerequisites
Confirm that you have Gravity Forms installed and activated and that you’ve installed and activated the plugin.
Using the Shortcode
When adding a form to a post or page via the [gravityforms]
shortcode, simply add the “cachebuster” parameter:
[gravityforms id="123" cachebuster="1"]
The form will then load via AJAX , bypassing the WordPress cache.
See our in-depth guide on Gravity Forms Shortcodes for more information on the shortcodes you might wish to utilise with Cache Buster as well as the other shortcode possibilities.
Apply to All Forms
If you would rather apply the Cache Buster to every form on the page, you can do so by adding the following line to your theme’s functions.php file.
add_filter( 'gfcb_enable_cache_buster', '__return_true' );
The Cache Buster will now automatically apply to every form on your site.
Known Limitations
Cache Buster does not work with single File Upload fields due to browser security. It does work with Multi-file Upload fields since they upload via AJAX.
Fresh Forms for Gravity
Another solution for automatically bypassing the cache is Fresh Forms for Gravity. It supports most of the caching plugins out there and requires no setup. Simply install it and your forms will be excluded from the cache.
Did this resource help you do something awesome with Gravity Forms?
Then you'll absolutely love Gravity Perks; a suite of 46+ essential add-ons for Gravity Forms with support you can count on.
Samuel in support helped me today with the Cache Buster, he said the developers have resolved the issue with Stripe in the latest version of the plugin. I tested it on a form that uses the Stripe addon and it worked fine in test mode. So may be worth revisiting for those who tried it before. It took 3 seconds off the page load time for me when I was able to use Varnish again. I previously could not have Varnish on the page (had used an exclusion rule) as it was stopping the child form from submitting to the parent form.
Hi Denis,
Thanks for testing this and sharing how it worked for you here.
Best
Hi We have embed the form in a post and in the form we have two hidden fields with the following default value: {embed_post:post_title} {custom_field:crm_course} The problem is that if we activate Cache Busting the value for these two hidden fields is empty, so the form doesn’t get the values from the post. Please have you any idea about the reason of this issue? Thanks
Hi Fabrizio,
I’m not really sure what’s happening but if you have an active Gravity Perks License, you can get in touch with us via our support form and we’ll be happy to dig into this furhter.
Best,
Great plug-in although it just spins when I upgrade my site from php7.4 to 8.0
https://elitedancestudio.org/drop-class/
Hi Jocelyn,
When testing locally it seems to work as expected in PHP 8.0. You can run a conflict test to check if any other plugins are conflicting with Gravity Forms. If not and if you have any further questions and you have an active license, you can get in touch with us via our support form.​ to dig into this.
Best,
I have realised this also doesnt work with paypal checkout aswell as stripe. I know you have messaged people saying send in a ticket. I dont mind paying for gravity perks to get this fixed but I want to know if you can get this to work on stripe and/or paypal first thankyou.
Hi Lewis,
From what I understand this is a limitation from Gravity Forms, caching, and how Payment gateways handle the data. I can confirm this can be fixed. We need to dig into each issue as an individual case.
Best,
Hello did you fix the issue with the gravityforms stripe addon? I thought id found the answer to my problems but stripe isnt working :-(
Hi Lewis,
If Cache Buster won’t work for you, I would suggest trying Fresh Forms for Gravity Forms.
Best,
Is there anyway for the ajax loader to loop, my form is quite large and takes a while to load on the page, the ajax loader doesnt loop so it looks like the page is blank.
Hi Lewis,
This will require some digging. If you have a Gravity Perks license, reach out via the support form so we can assist you further with this.
Best,
I’m not seeing any info about how to implement cache busting on a form that is embedded on the page via the Gravity Forms BLOCK versus a shortcode. Is there a way to do this when forms are put on the page with the block?
Also, I see where other people had issues with the Stripe add-on as we did. Is there any info about that you can provide other than asking us to submit a support ticket?
Hi Bet,
If you want to use Cache Buster with the Block Editor you will enable it for all forms in the site with this filter: https://gravitywiz.com/cache-busting-with-gravity-forms/comment-page-1/#apply-to-all-forms
About the Stripe question, you’re right the cache buster interferes with the display of the credit card field. We’ve followed up via email.
Best,
Hi my form has an hidden field that is populated with the value of a post Custom Field. With Gravity Forms Cache Buster active, the form doesn’t get the value of Custom Field in the post. Any suggestion? Thanks Fabrizio
Hi Fabrizo,
We’ll have to dig into this further to determine what’s happening. If you have an active Gravity Perks License, you can get in touch with us via our support form with an export of the form so we run some tests with it on our end.
Best,
Hi, I use Gravity Flow to enable the user to return to a partially filled in form (Gravity Forms Partial Entries) but if the user is not logged in, the form is not filled in when they return to it. If I use your plugin, the form is filled in (great, thankyou!). However, if I have your plugin installed, it interferes with the Gravity Flow reminder notifications for partially filled in forms (I can live with this as I have a work around in place for now) and more seriously it prevents the form from submitting correctly for Android users. The form actually submits but the user is not taken to the thank you page and form appears to endlessly load. This is causing great concern to our customers and they are trying to submit multiple applications as a result. I have reached out to Gravity Flow support to see if they can help with regards to the caching – but no luck as you can imagine. Can you please help?
Hi Melissa,
Unfortunately, we can’t really tell why this is happening without troubleshooting this further. If you have an active Gravity Perks license, you can get in touch with us with your account email address via our support form so we can dig into this issue. For now, I will suggest you run a conflict test to check if another plugin may be causing this. Here are instructions for how to run a theme/plugin conflict test:
https://gravitywiz.com/documentation/help-us-help-you/#2-run-a-theme-plugin-conflict-test
Best,
I noticed an incompatibility/bug with WPML. When using this plugin, WPML cannot update language in form on first pageview after language change. Needs a page refresh before form content is purged.
Hi Jesper,
If you have an active Gravity Perks License, you can get in touch with us via our support form with your account email address and we’ll be happy to dig into this further.
Best,
Hello guys!
Thanks for this! I’m trying it in a site now.
It’s working great!
The only thing that is happening is that I have 2 checkboxes already marked in the form’s settings, that is, when loading the form, these checkboxes already appear selected. But, when using Cache Buster, these checkboxes load unchecked. Any ideas?
Cheers
Hi John,
I’m passing this over to our developers to take a look into this. We’ll update this comment when the issue has been resolved.
Best,
Hello Samuel! Thanks
Another situation I’m seeing is: fields which uses merge tags to populate its values aren’t working also
Best :)
Hi John,
Thanks for the heads up. I wasn’t able to reproduce this issue locally. If you have an active Gravity Perks license, you can get in touch with us via our support form with your account email, so we see how best we can assist you.
Best,
Hi, My forms that are using the cache buster setting will not load since the updating to the latest version of Gravity Forms. Have you had any other reports of this? Many thanks Mel
Hi Melissa,
Thanks for letting us know. I am forwarding this to our developers to work on a fix. We’ll update this comment when the fix is ready.
Best,
Hi Melissa,
After further testing on our end, the cache buster works without any issue on Gravity Forms 2.5. I was only able to recreate the issue with one particular form but when I created that form, I was unable to recreate the issue on the new form.
This appears not to be an issue with the snippet but a form-specific issue. If you have a Gravity Perks License, you can get in touch with us via our support form so we can dig into this further.
Best,
Hi,
I have just installed your cache busting plugin. Thank you – I had tried everything else still couldn’t return to a partially filled form if I wasn’t logged in. I don’t want to display the title nor description on my form, so my gravity form shortcode previously had set title and description to false.
[gravityform id="1" title="false" description="false" cachebuster="1"]
This is working on Chrome (desktop) but it is still showing the title on Safari (iPhone) and Firefox(desktop). Am I using the shortcode correctly?
Many thanks
Hi Melissa,
Thanks for bringing this to our attention. I’ll pass this over to our developers to take a look into this. That said, as a workaround, you can use the shortcode without the title and description parameter. Something like this [gravityform id="1" cachebuster="1"], should do the trick and ensure the Title and Description aren’t displayed on the form.
Best,
Guys, The live merge tags does not work when cache buster is enabled.
Any suggestion?
Hi Don,
I am unable to recreate the issue you’re experiencing. The Live Merge tags works as expected when I tested it on my end. If you’re a Gravity Perks customer, you can get in touch via our support form so we can assist you further.
Best,
Does not work with Gravity Forms Stripe…
When using this and stripe v3.85, the cache buster breaks stripe such that the credit card field is hidden – I’m guessing it interferes with the stripe iframe from showing…
Disabling the cache buster allows the stripe field to show again, but then the form totals are wrong because of the cache !
Hi TomazHurtz,
You’re right the cache buster interferes with the display of the credit card field. If you are a Gravity Perks customer with an Advanced or Pro license, drop us a line and we can look into adding support for this.
Best,
This looks really good.
The plugin download button doesn’t work though.
Please advise.
Hello Zunaid, Thank you for that report. Let me get a request in to get this resolved. In the mean time, you can add the snippet version to your themes functions.php file and see if that works for you. Will update when resolved. 😀
Hello Zunaid, Wanted to update you on this one as we have resolved this issue. Please go ahead and click the download button again and you should be all set. 😃
The Embed URL does not work there anymore -> Do you have a fix for this?
We’re replying to this via the support ticket.
Work Well! Just not working with a {embed_url} conformation redirect, it results in a blank page. Any workaround?
Thanks
Right, I’m aware of that, but are there some minimum requirements for PHP, for example, for this to be effective?
Hi Scot,
I just ran a version check, and this plugin shows no issues with PHP 5.6 or greater.
Are there any minimum requirements for this plugin, much like those listed for Fresh Forms?
Hey Scot, Please just confirm that you have Gravity Forms installed and activated and that you’ve installed and activated the plugin or cache buster code listed above.😃