We have a setting in The Events Calendar that helps speed up the calendar month view by caching the events on the calendar, so they load faster on the next page refresh.

You’ll find the “Enable the Month View Cache setting at Events → Settings → GeneralSelecting that option will save the HTML for your Month View in a transient. That way, the events don’t have to be pulled from the database of everything the site is visited. Instead, the calendar displays the saved HTML fragment and loads faster as a result.

If you are customizing the month view template, you’ll probably want to disable this setting because there’s a chance that the plugin’s template file will load instead of your custom version. By disabling this setting, your changes to the template will always load. That said, you can keep the setting enabled and toggle it to refresh the cache and display your changes.

Calendar views

We released updates to the calendar view designs in The Events Calendar 5.0. This introduced a lot more flexibility to how HTML caching behaves, including a way to filter when something is cached as well as fully deactivate cache from loading altogether.

The tribe_events_views_v2_should_cache_html filter accepts three parameters, one of which allows more control over when to cache.

For example, disabling cache can be done with a filter in your functions.php file:

<?php
add_filter( 'tribe_events_views_v2_should_cache_html', '__return_false' );

This snippet is capable of lots of other things. But please note that caching is not something to be modified unless you are very aware of possible security consequences.

Normal expiration is a full day in seconds, but you can modify that using a filter as well:

<?php
add_filter( 'tribe_events_views_v2_cache_html_expiration', function() {
    return 2 * DAY_IN_SECONDS;
} );

It’s worth noting that the calendar’s week and month only cache two months’ worth of past events and up to one year of upcoming events.