Description
Font loading is one of the largest contributors to Largest Contentful Paint (LCP) on real websites. Peakspire Font Loading Optimizer applies the three highest-impact font fixes, built from hands-on Core Web Vitals engineering on production sites:
-
Preload local WOFF2 fonts – Scans your enqueued stylesheets for locally hosted WOFF2 files and adds
<link rel="preload">tags, capped at 4 fonts. Preloaded fonts arrive before the browser discovers them inside CSS files, removing the font round-trip from the critical path. -
Adds
font-display: swapto eligible inline@font-facerules – Rules that already declare an explicitoptional,block,fallback, orautovalue are never touched. Rules without a descriptor getswap, so text renders immediately with the fallback font instead of sitting invisible while web fonts download. -
Remove external Google Fonts (optional) – Dequeues all fonts.googleapis.com requests for sites that have self-hosted their fonts.
-
Remove dashicons for visitors (optional) – Dequeues the dashicons stylesheet for logged-out visitors, saving a render-blocking request most themes never use on the front end.
Everything is front-end only and safe to use alongside caching plugins (WP Rocket, LiteSpeed Cache, W3 Total Cache, etc.).
Why only local fonts are preloaded
Cross-origin font preloads waste bandwidth when the crossorigin fetch does not match the stylesheet fetch. This plugin deliberately preloads only same-host WOFF2 files, the safe default for virtually all themes that self-host fonts.
Installation
- Upload the
peakspire-font-loadingfolder to/wp-content/plugins/, or install via the Plugins screen. - Activate the plugin.
- Open Settings → Peakspire Font Loading Optimizer. Preload and font-display are on by default; both are recommended.
FAQ
Which fonts does this preload?
WOFF2 files hosted on your own domain that are referenced from enqueued external stylesheets, up to a static maximum of 4 per page. Fonts declared inline in the HTML head are deliberately NOT preloaded: the browser already discovers those at parse time, so preloading them adds bandwidth cost without benefit (measured: a ~0.9s LCP regression on an inline-declaring theme before this rule was enforced). This is a deliberate simplicity tradeoff: the plugin does not measure per-page font relevance (paid performance suites do). For most sites with 2-4 font families, the cap is the right size; preloading more fonts typically hurts more than it helps.
Does this replace a font-localization plugin like OMGF?
No – it complements one. Localization plugins handle fonts sourced from Google/Bunny CDNs. This plugin handles the other half: the fonts your theme or builder already bundles locally. Use both if you have both.
Does this work with caching plugins?
Yes. All changes are front-end output (preload tags and CSS descriptor injection). Nothing modifies your theme files or cache behavior.
What if my fonts come from Google Fonts?
Enable the “Remove external Google Fonts” option only after self-hosting your fonts. Sites not ready for that step should leave it off.
Is the font-display change safe for my design?
font-display: swap shows the fallback font until your web font loads, then swaps. It is the descriptor Google recommends and the default in most modern themes.
What does “Add swap to external stylesheets” do?
Many themes put their @font-face rules in a CSS file with no font-display descriptor, so text sits invisible while the font downloads. The plugin re-declares those rules after your stylesheet with font-display: swap added; everything else in the original rule (weight, style, unicode-range) is kept exactly as your theme wrote it, and relative font URLs are rewritten to absolute against your stylesheet’s own address so the override loads the same file. Rules that cannot be carried over safely (unusual URL schemes, markup-like content, or rules nested inside @media blocks) are skipped rather than approximated. If a stylesheet redirects to a different directory, relative font URLs are still rebased against the original stylesheet address rather than the redirect target; verify the font still loads in that case, or exclude that stylesheet from the override. Rules that already declare a font-display value are never touched, and families that look like icon fonts are skipped automatically because swapping an icon font shows wrong glyphs. You can extend the skip list with the fsfix_swap_skip_families filter.
When does the first scan run?
Activation does not fetch your homepage during the activation request. A one-time background scan is queued and usually runs within a few minutes; until then the settings page shows that a scan is pending, and the Re-scan button runs it immediately. On hosts where the background task scheduler only fires on site visits, quiet sites may wait longer. Deferral does not change what the scan sees: the fetch is anonymous, so bot shields and password-protected or staging environments that block anonymous self-fetches still record a failed scan.
How many stylesheets does the scan read?
Both preload discovery at page render and the homepage scan read at most 3 stylesheets hosted on your own domain, and preload at most 4 WOFF2 fonts. Themes that enqueue more than 3 same-host stylesheets have only the first 3 scanned; this bound keeps cold discovery from stacking network fetches into page rendering.
Why can a font be missed in a very large stylesheet?
Fetches stop reading after 2 MB of response body, for both stylesheets and the homepage scan. Fonts declared past that point in a very large stylesheet (or on a homepage larger than 2 MB) are not seen, so they are neither preloaded nor reported by the scan.
Has the performance impact been measured?
Plugin Check passes with two deliberate advisory warnings: the bundled-translations loader call (kept so the shipped languages/ directory works before translate.wordpress.org releases a language pack), and a display-only status flag read. Measured A/B (PSI mobile lab, 3 runs per state): (a) zero LCP regression on a theme declaring fonts inline in HTML (plugin correctly emits no preloads there); (b) on a page loading fonts from an external stylesheet, preloads start at time 0 (parallel with CSS fetch) vs after CSS parse without the plugin – LCP parity in the lab because the test page LCP element did not depend on the external font. The preload parallelization is architecturally sound and verified in network-requests timing; real-world LCP improvement depends on the theme placing LCP-critical fonts in external CSS.
Font preloading can also WORSEN LCP when the preloaded bytes compete with render-critical resources on constrained connections: in one controlled Lighthouse mobile simulation (two local fonts served through a deliberately slow endpoint, no cache), preloading both discovered fonts increased median simulated LCP by roughly 138ms, and adding font-display:swap to the stylesheet helped far more (~613ms) than any preload configuration. Results depend on the page, the protocol, and delivery conditions; we disclose the unfavorable case rather than hide it.
Who is this for?
Site owners and developers who want clean local font preloading and font-display rules without heavy performance suites. The plugin is free and standalone, built and maintained by PeakSpire; if you want a full WordPress speed engagement handled for you, see the Speed Sprint service page.
Need help?
Open a thread in this plugin’s support forum, or reach out directly via the PeakSpire contact page.
Screenshots



Changelog
1.2.0
- font-display: swap now also covers @font-face rules inside your own stylesheets that ship without a descriptor: the original declaration is re-emitted after the stylesheet with swap added, so no theme file is modified and existing descriptor values keep winning
- Icon fonts are excluded from that override automatically (name patterns and Private-Use-Area unicode-range detection), with a fsfix_swap_skip_families filter for site-specific families
- New settings toggle for the external-stylesheet swap; stylesheet discovery and the override share one bounded, lock-guarded fetch per stylesheet
1.1.1
- Activation no longer fetches the homepage synchronously: a one-time background scan is queued (guarded against duplicate scheduling) and a pending state is shown until it runs; the manual Re-scan button is unchanged
- Scan counts font preload tags by parsed attributes (rel=preload plus as=font) instead of one fixed attribute order, so a conflicting optimizer that reorders attributes no longer triggers a false cache-stale warning; stringified tags inside inline scripts are ignored, and the counting is verified against the emitted markup of OMGF, WP Rocket, Autoptimize, Astra, Kadence, FlyingPress, and WordPress core
- FAQ now documents the deferred first scan, the 3-stylesheet scan cap, and the 2 MB fetch limit
- Settings shortcut link on the Plugins screen row, so the settings page is reachable without hunting through the Settings menu
- Internationalization cleanup and hardening: translators comments adjacent to every placeholder string, linkified notice output passed through wp_kses, and the readme Tested up to header reduced to a major version per the directory convention
1.1.0
- State-based activation notice reporting what a live homepage scan found (preloads verified, inline theme fonts, cache-stale HTML, Google-hosted fonts, or no webfonts), with per-state copy and dismiss-per-state memory
- Persistent Status section on the settings page (scan result, per-feature found/applied/verify rows) plus a Re-scan button; suppresses duplicate admin banner on the settings screen itself
- Full internationalization (
peakspire-font-loadingtext domain,.potcatalog) plus bundled Canadian French (fr_FR) translation - Uninstall cleanup prefix aligned to
fsfix_css_*andfsfix_lock_*
1.0.5
- Simplified output path: legacy buffer fallback removed, direct early-action output only
- WordPress 6.9 minimum, PHP 7.4+ verified
- Distribution package cleaned (assets excluded from the plugin zip)
1.0.4
- Rebranded to Peakspire Font Loading Optimizer with the permanent slug
- Plugin URI and author links now point to peakspire.ca
1.0.3
- Discovery prioritization: same-host stylesheets scanned first; CDN-hosted stylesheets no longer consume scan slots (they cannot yield same-host WOFF2 URLs)
- Real-theme tested on Twenty Twenty-Four: external CSS fonts correctly preloaded, inline declarations correctly skipped
- PHP 7.4 literal execution verified (Docker php:7.4-cli, lint + token scan)
1.0.2
- Security hardening: SSRF defense (private/loopback/link-local IP deny-list before fetch), cache-hit re-validation (same-host + is_string on every cached entry), corrupt-lock-value recovery (stale-reclaimable, not live-forever)
- Availability: preg_replace NULL guard on backtrack-limit exhaustion (never blanks a page)
- CSS correctness: @font-face rewrite scoped to
- Measured: zero LCP regression on inline-font themes; preload timing verified on external-CSS pages
1.0.0
- Initial release: WOFF2 preload discovery, global font-display:swap injection, optional Google Fonts removal, optional dashicons removal for guests.
