About GravityView caching
GravityView saves the entries each View finds. The next visit to the same page of the View reads that saved copy, so the page loads with fewer database queries. Caching is on for new Views unless you turn it off in the settings below.
Saved results #
When a View with caching on loads, GravityView saves its entries as a row in the WordPress options table. The row’s name starts with gv-cache- and includes the form ID.
- Each page of results, and each search, is saved as its own copy.
- Views sorted in random order are never cached.
- Views that use the DataTables layout use the same cache.
Changes to entries #
GravityView marks a form as changed when one of its entries is submitted, edited or deleted, or when an entry’s approval status changes. The next time a View of that form loads, GravityView deletes the form’s saved copies and searches the entries again, so visitors see the change right away. Until then, the form’s ID is kept in the option gravityview_cache_blocklist.
A change written straight to the database, such as an SQL query in custom code, doesn’t mark the form as changed. The View shows the old values until its saved copy expires, or until you clear it with the gravityview_clear_form_cache action from Filters and actions for developers.
Expired copies
Each saved copy expires after the View’s Entry Cache Duration, one day by default. After that, the next visit searches the entries again and saves a new copy. A task that runs once a day deletes expired copies from the database.
Change the default for all Views #
- Go to GravityKit, then Settings, and click GravityView.
- Click Caching, then turn Enable Caching on or off.

- When Enable Caching is on, enter how many seconds to keep each saved copy in Entry Cache Duration. The default, 86400, is one day.
- Click Save Settings.
These are the starting values for new Views. A View that was saved with its own caching setting keeps that setting when you change the defaults. A View that was never saved with one follows the defaults.
Change caching for one View #
- Edit the View and open the View Settings tab of the Settings box.
- Turn Enable caching on or off.

- When Enable caching is on, set Entry Cache Duration in seconds. The field is hidden while caching is off.
- Click Update.
With caching off, the View searches the entries on every visit, so every change shows at once. A shorter Entry Cache Duration brings changes that GravityView can’t detect, such as the database changes above, to the page sooner.
See a View without the cache #
Add ?cache to the address of the page that shows the View, as in example.com/waitlist/?cache. ?nocache does the same.
- The parameter works for users who can edit Views, which by default means administrators and editors. For other users and for visitors, it changes nothing.
- Only your page load skips the cache. Visitors keep getting the saved copy until it expires or the form’s entries change.
Turn caching off with code #
To turn caching off for every View, whatever its settings, add this code to your site:
add_filter( 'gravityview_use_cache', '__return_false' );Note: Adding custom PHP code snippets to your website shows where to add this code.
Defining the constant GRAVITYVIEW_DISABLE_CACHE as true in your wp-config.php file does the same.
Filters and actions for developers #
gravityview_use_cache: Returnfalseto stop using saved results. It overrides the global and View settings.gravityview_cache_time_entries: Sets how many seconds a View’s results are kept. It overrides the Entry Cache Duration of every View.gravityview_clear_form_cache: Marks a form as changed, so its Views search the entries again on their next load.
This keeps the saved results of every View for 10 minutes:
add_filter( 'gravityview_cache_time_entries', function () {
return 10 * MINUTE_IN_SECONDS;
} );Run this after your code changes entries of form 12 in the database:
do_action( 'gravityview_clear_form_cache', 12 );While code on the site uses gravityview_use_cache or gravityview_cache_time_entries, the Caching settings show a note that the filter could be overriding them.