How could using fonts via Google’s service possibly run afoul of GDPR? The fact of the matter is that, when a font is requested by the user’s browser, their IP is logged by Google and used for analytics.
Leverage Browser Cache, reduce DNS lookups/requests, reduce Cumulative Layout Shift and make your Google Fonts 100% GDPR compliant 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, OMGF will automatically start looking for Google Fonts whenever a page is requested on your website.
All Google Fonts are listed in the Manage Optimized Fonts section of OMGF’s settings screen. There, you can choose to:
- Preload fonts to reduce Cumulative Layout Shift above the fold,
- Unload fonts that’re not used by you, your theme and/or plugins,
- Set a Fallback Font Stack (OMGF Pro required), to further reduce Cumulative Layout Shift, or
- Replace (OMGF Pro required) font-families with system fonts to speed up loading times!
Other Features include
- Remove Resource Hints (preload, preconnect, dns-prefetch) pointing to
- Ensure text remains visible during webfont load by forcing the font-display attribute to your Google Fonts,
- Ensure text remains visible during webfont load by forcing the font-display attribute to all your other fonts! (OMGF Pro required),
- Reduce the file size of your fonts and stylesheets, by using the Force subset and Include File Types feature (OMGF Pro required),
Additional Features in OMGF Pro
- Multisite support,
- “Dig deeper” to find Google Fonts and optimize further. OMGF Pro supports:
@importstatements inside inline
@importstatements inside local stylesheets loaded by your theme and/or plugins,
- Web Font Loader (
- Early Access Google Fonts.
- Material Icons support.
- Modify your fonts’
src: url()attribute fully integrate with your configuration,
- Use this to serve fonts and the stylesheets from your CDN, or
- To serve fonts from an alternative path (e.g. when you’re using Security through Obscurity plugins like WP Hide, etc.), or
- Set a relative path to easily migrate from development/staging areas to production/live, or
- Anything you like!
- Upload the plugin files to the
/wp-content/plugins/host-webfonts-localdirectory, or install the plugin through the WordPress plugins screen directly.
- Activate the plugin through the ‘Plugins’ screen in WordPress
- Use the Settings -> Optimize Google Fonts screen to configure the plugin
For a more comprehensive guide on configuring OMGF, check out the user manual
For the FAQ, click here.
Contributors & Developers
“OMGF | Host Google Fonts Locally” is open source software. The following people have contributed to this plugin.Contributors
“OMGF | Host Google Fonts Locally” has been translated into 10 locales. Thank you to the translators for their contributions.
Interested in development?
- Added: workaround for Divi builder to identify unique Google Fonts stylesheets.
- Added: extra links to documentation in Manage Optimized Fonts section.
- Fixed: Changed links to new documentation hub.
- Fixed: don’t use WP_Filesystem to get and put file contents.
- Fixed: Minor performance improvement – content_url() is no longer used to generate download file URLs.
- Rewrote Modify Source URL option’s description.
- Fixed: using
print_r()in an output buffer caused 500 errors.
- Removed the remaining (one) entries of
OMGF::debug, because of this and Test Mode now allows for much user-friendly testing, anyway.
OMGF::debug()wrapper is still there for hardcore in code debugging.
- Removed the remaining (one) entries of
- Several code tweaks and fixes.
- Added: Test Mode, which allows you to test optimizations before releasing them to the public.
This option replaces Optimize for Logged-in Administrators/Editors.
- Fixed: several minor tweaks.
- Added: Removed Cache Directory in favor of an automatic approach to improve UX, because most people didn’t change the default value anyway.
- I.e. all files generated by OMGF are stored in a subdirectory of the Uploads folder (default
- For most of you nothing will change, but
omgf_upload_urlfilters are available for DEVs who want to modify the default value, although I really can’t think of a reason why you’d want to do that.
- I.e. all files generated by OMGF are stored in a subdirectory of the Uploads folder (default
- Reworded description of Optimize for logged-in Administrators/Editors option.
- Added: Compatibility with Mesmerize Pro theme; this theme loads Google Fonts asynchronously, which causes CLS.
- Added: UNIX timestamp cached stylesheets to make sure browser cache of visitors is busted, upon cache refresh.
- Fixed: Running Save & Optimize a 2nd time could trigger some firewall rules, due to the serialized array being passed along with the settings form’s POST action. This serialized array is now stored in the form using base64_encode() and decoded before being saved to the database.
- Fixed: Since the Google Fonts API has removed the
subsetsparamater and returns all subsets by default, OMGF now does the same. Unlike the Google Fonts API, OMGF does still respect and apply the parameter if it set, because it is still used by many themes and plugins.
- Re-worded Force Subsets (Pro) featured to clarify this behavior.
- Fixed: Some resource hints that were added using unconventional methods (i.e. not using
wp_resource_hints()) weren’t removed.
- Fixed: If no regular Google Fonts stylesheets were present, the
omgf_processed_htmlfilter would never be triggered.
- Fixed: Stylesheets on AMP pages would be rewritten to local stylesheets, while this is not supported by AMP.
- Removed: AMP handling (Pro) option from Advanced Settings, because it’s no longer supported by AMP.
- Fixed: don’t allow starting buffer twice.
- Fixed: always run if omgf_optimize parameter is set.
- Fixed: Use Site Address (URL) to run first optimization scan, instead of WordPress Address (URL), because the WordPress install URL can differ from the frontend URL.
- Fixed: Make sure stylesheet URL is properly decoded and HTML entities, etc. are removed, before attempting to process it. (This would cause parameters, like
display, to get lost).
omgf_optimize_query_subsetfilter to OMGF_Optimize class.
- Fixed: Previous versions of OMGF would save stylesheet handles without the appended ‘-css’ string. This is now brought back to guarantee a smooth transition to v5.
- Fixed: If
?nomgf=1parameter was set, preloads would still be loaded.
- Fixed: Added an extra check if file exists, before adding font files for preloading.
- Enhanced: A small speed boost for Save & Optimize.
5.0.0 – **The Better, Bigger, Faster, Stronger, Cooler, Awesomer Edition** | March 4th, 2022
- Added: Parse entire HTML document for Google Fonts stylesheets (instead of just wp_head())
- Added: Merged both Optimization Modes option into one automatically running option:
– A first scan is done upon Save & Optimize,
– A quick check is done on pageload, to see if other Google Fonts are found than the ones already found, and if so, they’re downloaded and replaced on-the-fly.
- Enhanced: The Download API is replaced for an easier, leaner and faster alternative and no longer uses the WordPress API.
– If the first request fails, a mirror is used to retry the request, before throwing an error.
– Fixes rest_no_route errors in some configurations.
- Enhanced: The Task Manager now offers a quick overview of downloaded stylesheets and their status, along with simple management tasks, e.g. cache flush, configure stylesheet and/or remove.
– When cache is marked as stale, it’s now possible to refresh the cache and maintain your stylesheet configuration.
- Added: Resource hints enqueued in wp_resource_hints() are now properly removed.
- Fixed: Smart Slider 3 compatibility.
- Several bugfixes, UX improvements and code optimizations.
4.6.0 | February 16th, 2022
- Fixed: Loading spinner wasn’t center aligned.
- Added: Force Optimization Mode Task Manager.
– Offers an easy overview of downloaded stylesheets and where they’re stored,
– Indicates stale cache files.
- Added: Clearer explanation of when to use Scan Posts/Pages VS Force Optimization Mode.
- Fixed: Cache handles weren’t removed when cache directory was emptied.
- Fixed: Tooltip in Manage Optimized Fonts section wasn’t aligned properly.
- Renamed: Manual Optimization Mode to Force and Automatic to Scan Posts/Pages.
4.5.19 | February 5th, 2022
- Fixed: Use of undefined constant in OMGF_Admin_Settings_Help class.
- Fixed: use of undefined constant ‘OMGF_DEBUG_MODE’.
4.5.17 | February 4th, 2022
- Hotfix: array to string conversion on line 252 in class OMGF_Frontend_Functions.
4.5.16 | February 2nd, 2022
- Fixed: WP 5.9 welcome banner removed from Help section.
- Added: Basic debugging throughout the plugin (can be enable by setting the OMGF_DEBUG_MODE constant to true);
- Fixed: Updated handle was overwritten by empty value if cache key wasn’t defined.
- Added: More user friendly error messages.
- Fixed: “Handle not provided” error should not kill the entire Download API process (post OMGF v4)
- Pro Feature: Fallback Font Stacks can now Replace an entire Google Fonts font-family.
4.5.15 | January 26th, 2022
- Tested with WP 5.9
- Fixed: WP 5.9 welcome banner displayed in Optimized Fonts Manager section.
4.5.14 | January 18th, 2022
- Fixed: Pro options Google Fonts Source URL and AMP handling couldn’t be saved.
4.5.13 | January 4th, 2022
- Secured: Properly check permissions when Download API is accessed.
4.5.12 | November 27th, 2021
- Secured: Prevent path traversal when cache directory setting is changed. (Thanks, @jsgm!)
4.5.11 | November 17th, 2021
- Documented: Updated links to fancy new documentation hub: docs.ffw.press
- Dev: Added $font_family to omgf_alternate_api_url filter.
- Dev: Added filter to detect_registered_stylesheets().
- Fixed: disable preload/unload when opposite checkbox is checked.
- Fixed: Updated RSS feed URL and properly encode retrieved XML to prevent parse error simplexml_load_string().
- Promo: Added force font-display promo material.
4.5.10 | October 18th, 2021
- Enhanced: API now cleans up excessive spacing and + symbols in requests before fetching fonts. This comes in handy when e.g. @import statements in CSS stylesheets are auto-formatted by IDEs.
- Fixed: API would crash when Google Fonts request turned up empty.
- Fixed: Added proper error handling for when downloading fonts failed.
- Documented: Added link to Troubleshooting Guide to Help tab.
4.5.9 | October 5th, 2021
- Fixed: content_url() should always be encoded, also if file already exists.
- Enhanced: If stylesheet is already generated, stop execution to decrease API request time.
- Fixed: use array_merge() to prevent unsupported operand types error.
4.5.7 | September 29th, 2021
- Enhanced: significantly reduced code running frontend.
- Fixed: internal requests to OMGF’s Download API are no longer treated as ‘remote’.
- Fixed: stylesheets are no longer skipped in some situations by the temp storage layer, before writing them to the database.
- Fixed: using the mass actions (e.g. unload all, unload italics) no longer affect font families with the same name in a stylesheet with a different handle.
- Fixed: Italic fonts are now properly detected by the API when CSS2 (variable fonts) API is used by themes and/or plugins.
- Fixed: Added my own self-managed fallback API mirror to prevent more Google Fonts API downtime.
- Enhanced: reduced code in Download API by ~20%.
- Dev: add-ons for OMGF can now use the show_loader() method.
- Several UX and performance tweaks.
- Fixed: Added Fallback API URL for when Google Fonts Helper is down.
- Enhanced: Added extra error handling in Force Optimization Mode.
- Fixed: API requests made in Force Optimization Mode are no longer forced to SSL. It now uses the protocol configured in Settings > General > WordPress URL.
- Fixed: Stylesheet handles containing spaces would prevent Optimize Google Fonts screen from rendering properly.
- Several refactors and code optimizations.
- Fixed: Prevent collision with other plugins when authenticating AJAX-calls.
4.5.4 | August 18th, 2021
- Security: Access to the Download API now requires a valid nonce to prevent CSRF.
- Security: Added authentication to Empty Cache Directory AJAX-call.
4.5.3 | August 17th, 2021
- Fixed: “Too few arguments to function OmgfPro_Frontend_AutoReplace::passthru_handle()” would occur if OMGF Pro was updated to v2.5.1 before OMGF was updated to v4.5.2.
- Security: Added checks to prevent path traversal and CSRF in Empty Cache Directory AJAX call.
4.5.2 | August 16th, 2021
- Pro Feature: Added promo material for @font-face detection in local stylesheets.
- Fixed: Fixed several warnings and notices.
4.5.1 | August 2nd, 2021
- Enhanced: Added post update notice to inform user of the plugin’s database changes. The current notice you were viewed was simply, because the current DB version wasn’t logged yet on your system. So if you’re reading this: Ha! Made you look! 😉
- Pro Feature: Added promo material for Fallback Font Stack (Pro) feature.
- Enhanced: moved Stylesheet Generator to its own backend API.
- Enhanced: moved Font Downloader to its own backend API.
- Enhanced: Updated description of Optimization Modes.
- Fixed: Fixed glitch in footer news ticker.
- Enhanced: Added several filter and action hooks to allow a more seamless integration with OMGF Pro and OMGF Additional Fonts.
- Several code and performance optimizations.
4.5.0 | July 28th, 2021
- [Removed] WOFF2 only option is superseded by Include File Types option, only available in OMGF Pro.
- [Removed] CDN URL, Cache URI and Relative URL options are combined into Fonts Source URL option, only available in OMGF Pro.
- [Removed] Optimization Mode > Automatic is only available in OMGF Pro.
- Tested with WordPress 5.8
- Several code optimizations.
- Fixed logo for Safari compatibility.
- Added updater notices for future important updates.
- Fixed a few warnings/notices.
- Re-worded some options and option descriptions.
- Upped static version of Admin CSS files.
4.4.1 | April 23rd, 2021
- Fixed footer logo (load from local source instead of external URL).
- Added tooltip for preload option.
- Added link to OMGF Additional Fonts under Optimize tab.
4.4.0 | April 10th, 2021
- Moved sidebar to its own ‘Help’ tab to clean up the interface.
- Manage Optimize Fonts panel is now shown inline with other options (and has its own label).
- Each stylesheet’s handle is now more prominently visible and the font family is more readable.
- Added mass actions to each font family for easier management of each stylesheet.
- Took a different approach to deal with SSL/Non-SSL for local Dev environments.
- Performance improvements to manual detection mode (decreased risk of timeouts!)
- Overall UX tweaks and performance improvements.
4.3.2 | April 5th, 2021
- Fixed MIME type (
X-Content-Type-Options: nosniff) related errors when using Download API.
- When site is not using SSL, sslverify is disabled when contacting the Download API.
- When OMGF Pro is running in Automatic Mode, only preloads for the currently used stylesheet are loaded.
4.3.1 | March 29th, 2021
- Added Mukta (FKA Ek Mukta) to list of renamed Google Fonts.
4.3.0 | March 17th, 2021
- [FEAT] Renamed fonts will now be captured using their new name (e.g. Mulish), but remain in the stylesheet with their old name (e.g. Muli) to prevent manual changes to the stylesheet after optimization.
- [FEAT] Added Load WOFF2 Only option.
- Small code optimizations in Download API’s code.
4.2.8 | March 12th, 2021
- [FIX] Strings with a + instead of a space would returned errors in the API.
4.2.7 | March 10th, 2021
- Addding ?nomgf=1 to any URL will now temporarily bypass fonts optimization, which allows for easier debugging.
4.2.6 | March 6th, 2021
- Tested with WP 5.7
- [FIX] All fonts would be loaded, when all fonts of one font-family were checked for unloading.
- [FIX] Fixed some notices and warnings.
- Added compatibility for OMGF Pro’s Early Access compatibility.
- OMGF’s admin JS is now only loaded on OMGF’s settings screens.
- [FIX] Fixed bug where Italic 400 fonts couldn’t be unloaded.
4.2.5 | January 27th, 2021
- Improved compatibility with WordPress subdirectory installs.
- Implemented some actions/filters needed for upcoming release of OMGF Additional Fonts.
- Fixed duplicate preload ID’s issue.
- Fixed some notices/warnings.
- Minor UX improvements.
4.2.4 | December 8th, 2020
- Cache keys are now fixed values instead of dynamically generated. This fixes the bug where preloads wouldn’t load properly when combined with unloaded fonts of the same stylesheet.
- IMPORTANT: To fix any bugs with preloads/unloads, emptying the cache directory is required.
- Cleaned up the sidebar and added a notification to reassure people that no features were moved from Free to Pro after upgrading to v4.
- Advanced Processing can now be disabled even when OMGF Pro is active. Before it was always on (accidentally).
- When preload is enabled for a font style, its associated unload checkbox is disabled and vice versa.
- Minor fixes, increased usability and optimizations.
- Fixed invalid preload header,
- Fixed warning:
array_keys() expects parameter 1 to be array, null givenwhen multiple stylesheets are loaded, but preloads are only enabled for one of them.
- Small fix for themes/page builders which requests Google Fonts with protocol relative URI i.e. ‘//fonts.googleapis.com’ instead of ‘https://fonts.googleapis.com’.
- Tested with Elementor. Works.
- OMGF now checks secure (https://) and non-secure (http://) requests to Google Fonts, because apparently some themes still do that, even though it’s 2020, but whatever.
- Tested with Divi and Bridge Theme. Works.
4.2.0 | The What-4.0-should’ve-been Edition | October 7th, 2020
- IMPORTANT NOTICE: If you’re upgrading from v4.x.x it’s required to Empty your Cache Directory. Otherwise the Optimized Google Fonts Overview will not work.
- Added CSS2 (Variable Fonts) compatiblity,
- No more spaces in filenames of downloaded fonts,
- Added Optimize Fonts tab, which resembles the ‘Generate Stylesheet’ tab from v3, and features,
- Optimization Mode: Force or Scan Posts/Pages,
- If Force is selected, the URL can be specified which should be scanned for Google Fonts,
- A complete overview of all detected fonts, grouped by stylesheet,
- Options to preload or unload for each font.
- Move settings to more sensible places and re-grouped them in 3 groups:
- Optimize Fonts,
- Detection Settings,
- Advanced Settings.
- OMGF will now throw a notice when a settings is changed which requires the cache to be flushed.
- Several tweaks and fixes in OMGF’s Auto Detection mechanism and Fonts Download API.
- Fixed issue where OMGF wouldn’t detect fonts in weight 400 (and 400 italic).
- Major UX improvements,
- Pros and Cons of each Optimization Mode are outlined upon selection,
- Show loaded while actions are taking place,
- Cleaned up sidebar and added a clear overview of available documentation.
- Several tweaks and optimizations in overall performance.
- Fixed bug which would continuously show ‘No fonts founds’ notice in admin, among others.
- Increased compatibility with caching plugins, which would cause static pages to be served and block OMGF from pointing requests to its Download API.
- Added some notices (which disappear ;-)) for manual optimization process in admin area, making it clear when optimization is finished.
- Fixed syntax error (unexpected ‘)’ on line 147).
- Use transients instead of options.
- Fixed some minor notices and warnings.
4.1.0 | October 1st, 2020
- Added some on-boarding to ease the use of the new interface.
- OMGF will now show a notice in the admin area, if the optimization never ran, to increase UX.
- Added a loader when any of the following actions are triggered:
- Empty Cache Directory
- Start Optimization
- Minor tweaks and optimizations.
- Fixed bug where OMGF would trigger too late for the requests to fonts.googleapis.com to be captured.
- The tiniest bugfix ever: one space too much in a str_replace() caused Font Names with spaces (e.g. Roboto Condensed, or Open Sans) to not be captured correctly.
4.0.0 | September 30th, 2020
- OMGF now runs fully automatic to replace/remove Google Fonts from your pages using OMGF’s new Download API. No initial configuration required!
- This means that if you use different fonts on different pages, all of them will be cached and served locally.
- HUGE performance increase in OMGF’s automatic replacing/removing methods.
- Major overhaul of Settings Page:
- Removed Extensions Tab
- Some settings were moved to a new tab: Basic Settings.
- Improved Welcome and Documentation tab.
- Clarified option descriptions.
- Removed ‘Generate Stylesheet’ tab, which’ll be released in a separate add-on plugin soon.
- Removed ‘Use Web Font Loader?’ option, because it causes Cumulative Layout Shift and will not work with OMGF’s new Auto Replace feature.
- Removed ‘Remove Version Parameter’ option, because it has become obsolete. The new detection method uses the initial script’s version, if set.
- Font Preloading is temporarily removed and will be re-introduced (in a different form, along with new features) in a later release.
[ Changelog shortened … ]
OMGF – CORONA EDITION
* Moved Welcome-panel to the side.
* wp_remote_get() is now used instead of cURL.
* Complete code overhaul to increase performance and UX.
* Notices and errors are now more explanatory and dismissable.
* Fixed several bugs.
* OMGF now uses wp_options table, instead of own tables.
* Old tables are removed and data is migrated.
* Auto detect now works better than ever.
* Search now works bug free.
* WordPress’ default admin fonts no longer show up as results.
[ Changelog shortened … ]
Added Typekit’s Web Font Loader to allow loading fonts asynchronously.
[ Changelog shortened… ]
First release! No changes so far!