Host Google Fonts Locally
Leverage Browser Cache, Minimize DNS requests and serve your Google Fonts in a 100% GDPR compliant way with OMGF!
OMGF is written with performance and user-friendliness in mind. It uses the Google Fonts Helper API to automatically cache the fonts your theme and plugins use to minimize DNS requests and speed up your WordPress website.
HOW DOES IT WORK?
After installing the plugin, choose your Optimization Mode: Manual (default) or Automatic.
When Manual is selected, you can simply configure OMGF to work in the way you want, and run its detection mechanism on an address of your choosing.
In Automatic Mode, OMGF runs silently in the background and captures any requests made to fonts.googleapis.com or fonts.gstatic.com. When a webpage is first loaded, it reroutes these requests to its own Download API and copies the fonts over to your server. Then it generates a stylesheet for your fonts including EOT, TTF, WOFF and WOFF2 formats to guarantee maximum cross browser compatibility!
When the fonts are downloaded and the stylesheet is generated, it rewrites every URL (pointing to fonts.googleapis.com or fonts.gstatic.com) to the locally hosted variant.
Please keep in mind that, although I try to make the configuration of this plugin as easy as possible, the concept of locally hosting a file or optimizing Google Fonts for Pagespeed Insights or GT Metrix has proven to be confusing for some people.
- Automatically replace registered/enqueued Google Fonts in wp_head() with local copies,
- Automatically remove registered/enqueued Google Fonts from wp_head(),
- Manage Optimized Google Fonts,
- Preload above the fold fonts,
- Don’t load certain fonts or entire stylesheets.
- Leverage the font-display (swap) option,
- Serve fonts from CDN,
- Use OMGF with security through obscurity plugins.
FEATURES IN THE PRO VERSION
Everything in the free version, plus:
- Automatically remove/replace all Google Fonts throughout the entire document/page
- Also supports WebFont Loader (webfont.js) and Early Access Google Fonts.
- Combine all Google Fonts (made by your theme and/or plugins) stylesheets into one file
- Deduplicate Google Fonts stylesheets
- Reduce loading time and page size, by forcing the used subset(s) for all Google Fonts requests
- Remove Resource Hints (preload, preconnect, dns-prefetch) pointing to fonts.googleapis.com or fonts.gstatic.com.