Self-host Google Fonts downloads the Google Fonts your site uses and serves them from your own domain. Visitors’ browsers no longer connect to Google to get fonts. That removes a third-party connection from every page view and keeps visitors’ IP addresses away from Google.
Available in: Powered Cache Premium
Where to find it: Powered Cache → File Optimization → Fonts
How self-hosting works #
- When WordPress builds a page that uses a Google Fonts stylesheet (
fonts.googleapis.com/css…) or a Bunny Fonts stylesheet, Powered Cache downloads that stylesheet once on the server. - It downloads every font file the stylesheet points to (WOFF2, WOFF, TTF, OTF or EOT from
fonts.gstatic.comorfonts.bunny.net). - It saves the files in
wp-content/cache/powered-cache/google-fonts/and rewrites the stylesheet to use the local font files. - The page then links to the local stylesheet instead of Google. Both enqueued stylesheets and
<link>tags written into templates are replaced.
The downloaded copies are kept for 30 days. After that, they are downloaded again the next time a page needs them, so font updates from Google reach your site. Because page caching stores the finished page, the download happens only while a page is built, not on every visit.
Turn on self-hosting #
- Go to Powered Cache → File Optimization.
- In the Fonts group, turn on Self-host Google Fonts (Cache Google Fonts locally).
- Optionally keep Combine Google Fonts and Font Display Swap on. The combined request is the one that gets self-hosted.
- Click Save Settings and clear the cache.
- Open a page in a private window, then view the page source. The font stylesheet should now load from
/wp-content/cache/powered-cache/google-fonts/.
Default: off. When Powered Cache Premium is active, Apply Recommended Settings turns it on.
Self-hosting, Bunny Fonts or Combine? #
Combining only reduces the number of requests to Google. Bunny Fonts sends the requests to another provider instead of Google. Self-hosting is the only option where visitors connect to no font provider at all, which makes it the best choice when privacy rules such as the GDPR matter to you. See Which option should I choose? and Google Fonts and privacy.
What is not self-hosted #
- Fonts loaded by JavaScript, such as the Web Font Loader.
- Fonts imported inside another CSS file with
@import. - Font services other than Google Fonts and Bunny Fonts, such as Adobe Fonts.
For these, switch the theme or plugin to locally hosted fonts in its own settings.
Troubleshooting #
Pages still load fonts from Google #
Powered Cache never breaks your fonts when a download fails. If the stylesheet cannot be downloaded, the page keeps the original Google address and Powered Cache tries again after about five minutes. If a single font file cannot be downloaded, the local stylesheet keeps the Google address for that file until the local copy is refreshed. Downloads fail when:
- your server cannot reach
fonts.googleapis.comandfonts.gstatic.com(outgoing connections blocked by the host or a firewall), or a request takes longer than 5 seconds, - the
wp-content/cache/folder is not writable, - a stylesheet is larger than 200 KB or a font file larger than 3 MB.
Fix the cause, then delete the wp-content/cache/powered-cache/google-fonts/ folder so everything is downloaded again, clear the cache and load the page. Also check the sources listed in What is not self-hosted.
Fonts do not load when a CDN is used #
Browsers block fonts loaded from another domain unless the server allows it. If your CDN serves the local font files, turn on CORS for fonts in CDN integration.
For developers #
Change how long downloaded fonts are kept with the powered_cache_google_fonts_cache_ttl filter (in seconds, at least one hour). See the hooks reference.