manifest / performance / wp-google-fonts-local
WP Google Fonts Local
Self-host Google Fonts in WordPress: downloads font files locally for faster, privacy-friendly pages
★ 0stars
Install
This is the repository archive. It installs, but the folder name will carry the branch suffix and updates will not flow.
Install straight from GitHub with WP-CLI:
wp plugin install https://github.com/azanumer/wp-google-fonts-local/archive/refs/heads/main.zipNo built-in updater. New versions won't appear under Dashboard → Updates. Install new releases yourself, or let Git Updater track the repository.
Self-host the Google Fonts your theme uses. The plugin intercepts any fonts.googleapis.com stylesheet, downloads the CSS and its font files into wp-content/uploads/google-fonts/, and serves them from your own domain — one less third-party request, faster first paint, and no visitor data sent to Google.
How it works
- On the front end, the
style_loader_srcfilter catches any enqueued Google Fonts stylesheet. - The CSS is fetched with a modern browser user-agent so Google returns compact
woff2files. - Every
url(https://fonts.gstatic.com/…)in the CSS is downloaded and rewritten to a local URL. - The rewritten CSS is saved once per unique Google Fonts URL and reused on every page load — nothing is fetched on repeat visits.
Features
- Zero configuration — works with any theme that enqueues Google Fonts the standard way.
- Weekly refresh — a WP-Cron event clears the cache weekly so font updates are picked up.
- Tools page — Tools → Google Fonts Local lists every localized stylesheet with its download date, plus manual refresh and full purge buttons.
- Privacy-safe — any font URL that could not be downloaded is stripped from the CSS, so no request ever leaks back to Google.
Installation
- Upload the plugin folder to
/wp-content/plugins/. - Activate it from Plugins.
- Visit the front end of your site once — fonts are localized on first load.
Uninstall
Deleting the plugin removes the cache option, the weekly cron event and all downloaded font files.