functions.php or a site-specific plugin.
Cache and purging
lightify_is_cacheable
The final say on whether a page is cached. Runs after Lightify’s own checks.bool
required
string
lightify_cached_page_html
Filters the HTML about to be written to the cache file. This is how Lightify’s own features inject into cached pages, in priority order.string
required
lightify_cache_only_html
Like the above, but for content that should exist only in the cached copy and never in the live render. Lightify uses it to inject the web vitals collector, so the first uncached visitor is not measured.string
required
lightify_cache_file_name
Filters the generated cache file name, which is how cache variants are keyed.string
required
lightify_cache_mobile
Whether to write separate mobile rewrite rules.bool
default:"false"
lightify_htaccess_rules
The rules Lightify writes to.htaccess.
string
required
lightify_auto_purge_urls
The URLs an automatic purge will clear, after a post is saved or similar.array
required
Purge actions
Eight actions, one pair per purge type. Use:before to purge an external cache at the same time, :after to react once Lightify is done.
lightify_preload_urls
What preloading visits after a purge.array
required
lightify_preload_delay
Seconds between preload requests. Raise it on constrained hosting.float
default:"0.5"
lightify_serviceworker
The generated service worker source, before it is written.string
required
lightify_offline_fallback_page
The page served when a visitor is offline and the request is not cached.string
default:"/404/"
Asset optimizations
Each exclusion list on the settings screen has a matching filter. Use the filter when the exclusions are conditional, or when you want them in version control rather than in the database.
Each receives an array of keywords and returns one.
lightify_minified_css
The minified CSS for one file, before it is written.string
required
string
lightify_rucss_css
The CSS produced by unused CSS removal.string
required
string
lightify_rucss_include_selectors
Selectors forced into the generated CSS, the code equivalent of the CSS Inclusions field.array|string
required
string
lightify_interaction_timeout
Seconds before delayed JavaScript runs even without interaction.int
default:"5"
Lazy rendering
Raise the skip count if content below the fold on a short page flickers in.
Self-hosting
array
Which external domains are downloaded and served locally.
filter
Filters
$content, $url_new, $extension before an external file is saved. Use it to rewrite URLs inside a downloaded stylesheet.Images
Smart link prefetch
Score alerts
Four filters shape the email, each receiving the old and new grade and score.lightify_web_vitals_updated
Fires when new vitals are stored. Use it to forward measurements to your own monitoring.Integrations
Utilities
Settings and bootstrap
lightify_settings_update:before / :after
Fire around the settings write, both receiving$settings.
Progressify
Generatify
Lightify
Rankify
Snapshotify