WP Rocket is a popular WordPress performance plugin and works well alongside HomeRunner once a few settings are adjusted. Out of the box, WP Rocket’s aggressive defaults can interfere with the HomeRunner booking widget, calendar, and search. This guide walks you through the four configuration changes every HomeRunner site running WP Rocket should make.
At a glance #
| Setting | What to change | Why it matters |
|---|---|---|
| Delay / Defer JavaScript | Exclude HomeRunner and UIKit scripts | Prevents broken calendars and search widgets |
| Cache Lifespan | Set to 12 hours | Keeps booking nonces valid; avoids 403 errors |
| Never Cache URLs | Exclude HomeRunner REST endpoints | Ensures live availability and pricing |
| Auto-flush on update | Add a one-time snippet | Template and design changes appear immediately |
1. Exclude HomeRunner JavaScript from Delay and Defer #
HomeRunner’s booking widget, explorer, and date pickers rely on the UIKit JavaScript library. WP Rocket’s “Delay JavaScript Execution” and “Minify/Combine JavaScript” features can prevent UIKit from loading in time, leaving widgets unresponsive.
Where: WP Rocket → File Optimization → JavaScript
In both Delay JavaScript Execution → Excluded JavaScript Files and Minify/Combine JavaScript → Excluded JavaScript Files, add these patterns (one per line):
/wp-content/plugins/homerunner/
/wp-content/plugins/homerunner-(.*)
uikit
hkUIkit
hk-uikit
jquery
You will know it worked when:
- The property page calendar loads within a few seconds of arrival
- The browser console shows no “hkUIkit is not defined” error
- Date pickers in the explorer open and accept input
2. Cap cache lifespan at 12 hours #
WordPress generates a security token (nonce) that the HomeRunner plugin uses to validate availability, pricing, and quote requests. These tokens rotate every 12 to 24 hours. If a page is cached longer than the token lifespan, returning visitors hit a stale token and the calendar fails silently with a 403 error.
Where: WP Rocket → Cache → Specify time after which the global cache is cleared
Set to: 12 HOURS
Do not use 24 hours or longer. The safest value is 12 hours, which forces WP Rocket to refresh cached pages before WordPress invalidates the nonce inside them.
3. Exclude HomeRunner REST endpoints from caching #
The HomeRunner plugin uses REST API endpoints to deliver real-time availability, pricing, and quote data. These responses are different for every guest, every search, and every date range. Caching them returns stale results to subsequent visitors.
Where: WP Rocket → Advanced Rules → Never Cache URL(s)
Add these patterns:
/wp-json/homerunner/(.*)
/wp-json/wp/v2/property(.*)
/?rest_route=/homerunner/(.*)
If your site sits behind Cloudflare, a CDN, or a server-level page cache (FlyWP fastcgi, Varnish, etc.), apply the same exclusions at that layer too. WP Rocket rules do not propagate upstream.
4. Auto-flush WP Rocket when HomeRunner updates #
When the HomeRunner plugin or its template customizer updates, cached pages can keep serving the previous version of templates and styles until the cache is manually cleared. This snippet flushes the WP Rocket cache automatically whenever a HomeRunner plugin is updated.
Where to add it: Save as wp-content/mu-plugins/wprocket-homerunner-flush.php, or paste into Code Snippets.
<?php
/**
* Plugin Name: WP Rocket - Flush on HomeRunner Update
* Description: Clears WP Rocket cache when HomeRunner plugins update.
*/
add_action( 'upgrader_process_complete', function( $upgrader, $hook_extra ) {
if ( ! function_exists( 'rocket_clean_domain' ) ) {
return;
}
$slugs = [ 'homerunner', 'homerunner-template-customizer', 'homerunner-conversion-kit' ];
$changed = $hook_extra['plugins'] ?? [];
foreach ( $changed as $plugin_file ) {
foreach ( $slugs as $slug ) {
if ( strpos( $plugin_file, $slug . '/' ) === 0 ) {
rocket_clean_domain();
return;
}
}
}
}, 10, 2 );
Verification checklist #
After applying all four sections, walk through this checklist on a property page in a private/incognito window:
- Hard refresh the page. The calendar populates within a few seconds.
- Open the browser console. No “hkUIkit is not defined” errors appear.
- Open the date picker in the explorer or search bar. Dates select correctly.
- Click Book. The quote loads and the Book button becomes active.
- Update the HomeRunner plugin from the WordPress admin and reload a property page. Template changes are visible without a manual cache clear.
Troubleshooting #
Calendar still hangs on loading after configuration
Test in a fresh incognito window. A stale wordpress_logged_in_* cookie from a prior session can cause the same 403 symptom even after cache settings are correct. If incognito works, clear cookies for the site in your normal browser. This is browser state, not a site bug.
Calendar works for some visitors but not others
Check that your CDN or full-page cache (Cloudflare, FlyWP fastcgi, Varnish) honors the same exclusion rules in section 3. WP Rocket’s “Never Cache URL(s)” only applies at the WP Rocket layer.
Template or design changes still take time to appear
Confirm the snippet from section 4 is active. As a one-time fix, clear the WP Rocket cache manually from the WordPress admin bar.