General Optimization Recommendations
Events Manager runs well on a default install. This page is for sites that want to trim page weight, sites behind a page cache, and sites with a large number of events. It covers what to cache, the settings that reduce the files and queries on each page, and advice for large sites.
Page caching
Page caching is the biggest single gain for most sites, and Events Manager is built to work with it.
Booking forms on cached pages
A booking form carries a security token that expires. On a cached page that token would go stale, so when Events Manager detects a caching plugin it fetches fresh tokens in the background each time the page is opened. Detection relies on the WP_CACHE constant, which caching plugins add to wp-config.php.
If your cache works outside WordPress (a host's server cache, Varnish, or a CDN that caches whole pages) the constant is usually not set. Tell Events Manager yourself:
define( 'EM_CACHE', true );
Without it, visitors who open a cached event page may see This booking form has expired, please reload the page and try again. when they submit.
What not to cache
Exclude these from your page cache. Each shows content that differs per visitor:
- The My Bookings page, and the front-end pages for managing events, locations and bookings, all assigned in Events then Settings then Pages.
- The payment page and any checkout page of a payment gateway Pro.
- Requests to
wp-admin/admin-ajax.phpand the REST API (/wp-json/), which caching plugins leave alone by default.
Most caching plugins already skip the cache for logged-in users. Keep that behavior.
Availability on cached event pages
A cached event page shows the number of spaces left as it was when the page was cached. Nobody can overbook because of this: availability is checked again on the server when the booking is submitted, and the visitor gets the usual "fully booked" message if the spaces have gone. To keep the numbers fresh, give event pages a short cache lifetime, or clear the cache for an event when it gets a booking if your caching plugin can do that.
Load scripts and styles only where needed
By default Events Manager loads its JavaScript and CSS on every front-end page, so that a calendar widget or a shortcode works wherever you put it. If events only appear on some pages, you can limit the files to those pages.
The settings are in Events then Settings then General then Performance Optimization (Advanced). They apply to the front end only.
Options for minified files and for limiting where scripts and styles load.
With limits on, an Events Manager shortcode, block or widget on a page you have not listed appears without its styling, or stops responding to clicks. After changing these settings, check every page where events, calendars, search forms or booking forms appear.
JavaScript files
| Setting | What it does |
|---|---|
| Load minified JS files? | Loads the compressed version of the plugin's script. Default No. |
| Limit JS file loading? | When Yes, scripts are loaded only on Events Manager's own pages and the pages you list in the four fields below. Default No. |
| General JS | Pages that need the main script: any page with a calendar, map, booking form or booking button placed by shortcode, block or widget. |
| Search Forms | Pages where you show the events search form, other than your events page. |
| Event Edit and Submission Forms | Pages where you show the event submission form, other than the page assigned for it. |
| Booking Management Pages | Pages where you show booking management tables, other than the page assigned for it. |
Enter page IDs separated by commas, for example 12,48,105. Enter 0 to mean every page and -1 for the blog home page.
Pages that are always covered, with nothing to list: single event and location pages, and the events, My Bookings and front-end management pages assigned in Events then Settings then Pages.
CSS file
| Setting | What it does |
|---|---|
| Load minified CSS files? | Loads the compressed stylesheet. Default Yes. |
| Limit loading of our CSS files? | When Yes, the stylesheet loads only on Events Manager's own pages (the same ones listed above) and on pages you add. Default No. |
| Include on | Extra page IDs where the stylesheet should load. 0 means every page. |
| Exclude on | Page IDs where it must not load. This wins over Include on and over the automatic pages. 0 stops the stylesheet loading anywhere. |
If your theme styles events completely, you can also switch off parts of the plugin's styling under Styling Options (Advanced) on the same tab, where calendars, lists, single pages, search forms and booking forms each have their own switch.
Thumbnails
Disable WordPress Thumbnails? makes event and location images use the full-size file, scaled by width and height attributes in the HTML. Leave it at No unless an image service such as Jetpack's image CDN resizes images for you. With it on and no such service, every list downloads full-size images.
Keep lists light
Lists and calendars are where most database work happens. A few settings keep them cheap:
- Limit list length. Event List Limits in Events then Settings then Pages then Event List/Archives sets how many events a list shows by default (10 on a new install). In shortcodes, set
limitand turn onpaginationin preference to one long list. See search attributes. - Use a scope. Lists default to future events. Avoid
scope="all"on pages that get traffic, since it reads every event you have ever published. - Keep formats lean. Each placeholder in a list format is worked out for every event in the list. Placeholders that load related data, such as a location's next events or a category's event list, multiply the work when they are used inside a list.
- Switch off features you don't use. Under Events then Settings then General, turning off tags, categories, attributes, locations or bookings removes them from the editor and from the front end.
- Load maps only where they help. Google Maps adds an external script and requests to Google on every page that shows a map. See Google Maps for the lighter embed and static map types.
Large sites
For sites with thousands of events or bookings:
- Use a persistent object cache (Redis or Memcached) if your host offers one. Events Manager keeps the events and locations it has loaded in the WordPress object cache, so a persistent cache saves those lookups on later page views.
- Tidy up past events. With Events Manager Pro Pro, Past Events Action can change the status of, trash or delete events once they end, which keeps admin lists and queries short.
- Run WP-Cron from the server. Reminder emails, payment time limits and clean-up tasks then stop depending on visitors and stop adding work to page views. See Scheduled tasks.
- Send email through SMTP. Bulk reminders sent with PHP mail are slow and often blocked. See Email settings.
Troubleshooting
Calendars or booking forms stopped working after I limited JS
The page is missing from General JS. Add its ID, or set the field to 0 to load the main script everywhere while keeping the other limits.
Events look unstyled on one page
The page is missing from Include on, or it is listed in Exclude on.
Visitors see "This booking form has expired"
The page came from a cache that Events Manager doesn't know about. Add the EM_CACHE constant shown above.
A security scanner flags the minified script
Set Load minified JS files? to No. The unminified file does the same job.