The Views plugin provides a caching mechanism that allows Views with long queries to be rendered faster, since the whole output is stored in the database.

There are a lot of tools and options available in Views that facilitate the building of complex queries, in order to produce the desired output. Sometimes, the execution of these queries can become processor resource-intensive and time-consuming, as the output complexity increases.

Caching is not available for all Views, as the front-end rendering of a View may depend on many elements. For the eligible Views, this feature is turned on by default, but you can easily turn it off, by selecting the corresponding option when you insert a View. To do this, click the Caching tab in the View insertion dialog and select the desired option there.

Turning off caching when inserting a View
Turning off caching when inserting a View

Cache is automatically turned off for Views when:

  • The user is loading a page, different from the first one, in a paginated View.
  • The user is loading a custom search View after performing a search.
  • Debug mode is enabled on the Toolset -> Settings page’s Front-end tab.
  • The View shortcode has any attribute other than name, id or target_id, since the results of this View will be modified, thus preventing the user from viewing the cached output.
  • target_id has been set to self, since we do not know what the actual target of the custom search is.
  • The View has an option for random sorting of the results.
  • The View is nested or has a filter or an option that depends on the current page, current user, or current archive data. Note that this invalidates cache when Don’t include current page in query result query option is checked.
  • The View has a filter or option that requires a value from a registered framework option, since this value can be changed outside of the Views.
  • Filter wpv_filter_disable_caching is used to manually disable the caching system.
  • The WPML plugin is active, since the same View can produce different results for different languages.
  • The View includes a map.

Things that also change the content or the status of posts, terms, or users will invalidate cache automatically. For example, when you update a post or create a new taxonomy term. The Views plugin automatically invalidates cache after 24 hours.