Skip to main content
View Categories

Using WP Rocket with HomeRunner

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 component, calendar, and search. This guide walks you through the five configuration changes every HomeRunner site running WP Rocket should make.

At a glance #

SettingWhat to changeWhy it matters
Delay / Defer JavaScriptExclude HomeRunner and UIKit scriptsPrevents broken calendars and search components
Cache LifespanSet to 12 hoursKeeps booking nonces valid; avoids 403 errors
Never Cache URLsExclude HomeRunner REST endpointsEnsures live availability and pricing
Auto-flush on updateAdd a one-time snippetTemplate and design changes appear immediately
Remove Unused CSSTurn it offKeeps search bars, cards and maps styled for guests

1. Exclude HomeRunner JavaScript from Delay and Defer #

HomeRunner’s booking component, 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 components 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 );

5. Leave Remove Unused CSS off #

Remove Unused CSS builds a trimmed stylesheet from the HTML that WP Rocket’s crawler receives from your server. HomeRunner renders the explorer, map, search bar and property cards in the browser, so that markup never reaches the crawler and the CSS rules those components need get dropped. Guests then see an unstyled search bar, cards without layout, or map markers in the wrong place. Logged-in administrators bypass WP Rocket, so the page looks fine while you are logged in and the problem is usually reported by a guest.

Where: WP Rocket → File Optimization → CSS Files → Remove Unused CSS

Set to: off. Saving the change clears WP Rocket’s stored CSS and page cache for you.

If you decide to keep it on anyway, add these patterns to CSS safelist and use Clear Used CSS after every HomeRunner plugin update. Check the result in a private window, never while logged in.

(.*)hrtk-(.*)
(.*)hrck-(.*)
(.*)hk-(.*)
(.*)homerunner-toolkit/assets/css/(.*)
(.*)leaflet(.*)
(.*)homerunner/assets/vendor/leaflet/(.*)

WP Rocket itself is optional. If your host already runs a server-level page cache, as FlyWP and most managed WordPress hosts do, HomeRunner gains little from adding WP Rocket: the heavy part of a HomeRunner page is the explorer JavaScript and the live availability requests, and no caching plugin changes those.

Verification checklist #

After applying all five sections, walk through this checklist on a property page in a private/incognito window:

  1. Hard refresh the page. The calendar populates within a few seconds.
  2. Open the browser console. No “hkUIkit is not defined” errors appear.
  3. Open the date picker in the explorer or search bar. Dates select correctly.
  4. Click Book. The quote loads and the Book button becomes active.
  5. 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.