In late January, a German court fined a website owner for including webfonts hosted on the Google Fonts service. By using the service, the website owner had exposed the IP addresses of visitors to Google without the visitors consent, which the court deemed a violation of Europe’s General Data Protection Regulation (GDPR). The plaintiff received damages of 100 euro, and thousands of Google Fonts users recoiled in horror.
In light of the court case, the WordPress.org theme directory are strongly encouraging all theme authors to replace Google Fonts with locally hosted fonts. There already was a rule in place against including remote resources in themes on the theme directory, but until now, Google Fonts has been an exception. It seems likely that the rules will be updated with a complete ban on all remote resources soon.
I decided to spend some time this week to replace Google Fonts with locally hosted font files in almost all of my 21 free WordPress themes.
- Tove, my most recent theme and my only block theme, has been updated with the new
fontFamilytheme.json attribute to load local font files. It’s the same solution that the Twenty Twenty-Two default theme uses.
- My classic themes have been updated with a new
fonts.cssfile in the assets folder, which is enqueued with the same handle as the old Google Fonts request. If you have dequeued that handle in a child theme in the past, the dequeue should still work with this update.
The only theme of mine that still uses Google Fonts is Chaplin. Chaplin allows users to select any typeface from Google Fonts in a Customizer setting, and there isn’t a clean way to replace that solution right now. I obviously can’t bundle all of the 1426 typefaces on Google Fonts in the theme folder, and themes on the WordPress.org theme directory aren’t allowed to download resources from a remote server.
For now, Chaplin users can disable Google Fonts by selecting a system font stack in the Customizer setting. Another option is to use a plugin like Local Google Fonts, which detects enqueued Google Fonts and downloads the font files to the server.
All of the theme updates should be available in the Dashboard → Updates page in the administration panel of your WordPress site now. As always, if you’ve made changes directly to the theme files, those changes will be overwritten when the theme is updated. Use child themes, people.