Google Fonts is the most popular free font library for WordPress, and almost every theme, page builder and block pattern pulls from it. The catch is how most sites load it. By default, every page view sends the visitor’s browser to Google’s servers to fetch a stylesheet and the font files, and since a 2022 German court ruling that request has been a GDPR talking point for European website owners. The cleaner approach is to host Google Fonts locally in WordPress: download the files once, serve them from your own domain and remove every call to fonts.googleapis.com and fonts.gstatic.com.
This guide shows you how to load Google Fonts locally in WordPress five different ways (manual download, uploaded font files, plain CSS, two plugins and the built-in Font Library), how to find and kill the external requests your theme and plugins still make, how to preload the files for speed and how to prove the job is done. Every method comes with copy-ready code and a screen to compare against.
Quick answer: download the WOFF2 files for the weights you actually use, upload them to your site (for example
/wp-content/uploads/local-fonts/), register them with@font-face, remove the Google Fonts stylesheet and resource hints from your theme, then confirm in the browser’s Network tab that no request goes to a Google domain. Prefer automation? A plugin such as OMGF does all of this for you.
What Are Google Fonts in WordPress?
Google Fonts is a free directory of open-source typefaces run by Google. Using Google Fonts in WordPress simply means your site’s text (headings, body copy, buttons, menus) is rendered with a family such as Inter, Poppins, Lora or Roboto instead of the visitor’s system font. Because the library is free and has hundreds of families, it ships inside countless themes, page builders and WooCommerce templates.
Behind the scenes, the usual setup is a two-step chain through the Google Fonts API. Your theme enqueues a stylesheet such as https://fonts.googleapis.com/css2?family=Inter:wght@400;700&display=swap. That CSS file contains @font-face rules that point to the real font files on fonts.gstatic.com. The browser downloads the CSS first, discovers the font URLs and then downloads the files. That is two extra origins, two DNS lookups, two TLS handshakes and, importantly for privacy, two connections to a company outside your control.
A Google Font in WordPress can arrive through several doors, which is why a clean-up is rarely a one-line fix:
- The theme’s typography options (classic themes) or the Site Editor (block themes).
- A page builder’s font picker, such as Elementor, Divi, Beaver Builder or Kadence blocks.
- A plugin that enqueues its own stylesheet (sliders, forms, popups, WooCommerce add-ons).
- Hard-coded
@importlines or<link>tags inside theme files or custom CSS. - JavaScript that injects fonts at runtime, for example Web Font Loader.
Good news on licensing: most Google Fonts families are published under open licenses (the SIL Open Font License or Apache 2.0), which allow commercial use and self-hosting. Check the license shown on each family’s page, but in practice you can download, bundle and serve them yourself.
Why Should You Host Google Fonts Locally?
When you host Google Fonts locally in WordPress, the font files live in your own file system and are delivered from your own domain (or your own CDN). That small architectural change brings five practical benefits.
1. Privacy and GDPR risk reduction
No request goes to a Google domain, so no visitor IP address or browser details are sent to Google just to display a font. This is the main reason European sites switch, and it is covered in the next section.
2. Fewer connections and faster rendering
A remote Google Fonts setup needs the browser to open connections to two additional hosts before text can render in the right typeface. Serving fonts from your own origin reuses the connection the browser already opened for your HTML, and you can preload the one or two files that matter above the fold. If you run a store, this is one of the quick wins in our guide on how to speed up a WooCommerce store.
3. The “shared cache” argument no longer holds
For years the standard defence of the Google CDN was that visitors probably already had the font cached from another site. That stopped being true when browsers began partitioning their HTTP cache per site. Chrome introduced it in version 86 and explains that the cache key now includes the top-level site, so a font cached while visiting one website is not reused on another. You can read the details in Chrome’s cache partitioning write-up. In other words, the performance advantage of a shared CDN largely disappeared while the privacy cost stayed.
4. Control over weights, subsets and caching
With local files you decide which weights and character subsets ship, how long browsers cache them (a year is typical) and which fonts load on which templates. You are no longer at the mercy of a third-party stylesheet that adds or changes rules.
5. Resilience and consistency
Your typography keeps working on staging sites behind a firewall, in strict corporate networks, in countries where Google services are restricted and when a consent tool blocks third-party requests until the visitor opts in.
Benefits
- No font requests to Google domains
- One origin, easier preloading
- Full control of caching headers
- Smaller payloads through subsetting
- Works with strict CSP rules
Trade-offs
- You maintain the files yourself
- Font updates are not automatic
- Misconfigured headers can slow you down
- Plugins and builders may still call Google
- Needs a one-time audit and a recheck after updates
Google Fonts and GDPR: What WordPress Website Owners Should Know
The GDPR treats an IP address as personal data. When a page loads a font from Google’s servers, the visitor’s browser connects directly to Google, which necessarily receives that IP address along with ordinary request details such as the user agent and the page that referred the request. Google publishes a privacy and data collection FAQ for Google Fonts describing what the service logs and what it does not use for ad targeting. The GDPR question is not whether Google misuses the data, it is whether your site had a legal basis to send it there in the first place.
The Munich ruling
On 20 January 2022 the Regional Court of Munich (LG München I, case 3 O 17493/20) ruled that a website operator who embedded Google Fonts from Google’s servers without the visitor’s consent had unlawfully transmitted the visitor’s IP address to Google. The court reasoned that there was no legitimate interest that justified the transfer, because the fonts could simply be hosted on the site’s own server. It awarded the claimant €100 in damages and ordered the site to stop. News outlets such as The Register covered the decision, and a wave of warning letters to small site owners in Germany and Austria followed.
What it means today
A first-instance ruling from one German court is not law across the EU, and the rules for transatlantic data transfers have changed since 2022. Reasonable people still disagree about how far the decision reaches. But the practical takeaway has not changed: self-hosting removes the question entirely. If the stylesheet and font files are served from your domain, no font request involves Google, and you do not need a consent banner just to display your typography.
- Serve every font file from your own domain or your own CDN.
- Remove the Google Fonts stylesheet,
@importlines and resource hints. - Mention the fonts you host and the font licenses in your privacy documentation if you list technical details.
- Re-scan after theme, plugin and builder updates.
This article explains a technical approach and is not legal advice. If you serve visitors in the EU and have specific compliance questions, talk to a qualified privacy professional.
How to Check Whether Your WordPress Website Loads Google Fonts Externally
Before changing anything, find out what your site does today. Use a private window, log out of WordPress (admin screens behave differently) and test several templates: the homepage, a blog post, a WooCommerce product page and the checkout.
Check 1: the browser’s Network tab
- Open your site in a private window and press F12 (or right-click and choose Inspect).
- Open the Network tab and tick Disable cache.
- Reload the page and click the Font filter.
- Look at the Domain column. Any row from
fonts.gstatic.com, and anyfonts.googleapis.comentry under CSS, means you are still loading Google Fonts externally.
Check 2: search the page source
View the page source (Ctrl+U or Cmd+Option+U) and search for googleapis and gstatic. You will often find a <link rel="stylesheet"> plus a <link rel="preconnect"> for fonts.gstatic.com.
Check 3: command line
If you have shell access, list every Google Fonts reference in the rendered HTML, in your theme and plugin files and in the database (page builders and Customizer settings often store font URLs there):
# 1) Rendered HTML of a page
curl -s https://example.com/ | grep -oE "https://fonts\.(googleapis|gstatic)\.com[^\"' )]*" | sort -u
# 2) Theme and plugin files
grep -R --include="*.php" --include="*.css" --include="*.js" -l "fonts.googleapis.com" wp-content/themes wp-content/plugins
# 3) Database (WP-CLI)
wp db search "fonts.googleapis.com" --all-tables --before_context=0 --after_context=0
Write down every file and setting that shows up. That list is your to-do list for the rest of this tutorial.
How to Find and Download Google Fonts
Start by choosing fonts. Fewer is better: two families (one for headings, one for body text) and two to four weights cover most designs. If you need inspiration, browse our roundup of the best Google web fonts for WordPress websites.
Download from Google Fonts
- Open fonts.google.com and search for your family.
- On the family page, click Get font, then Download all.
- Unzip the archive. You will usually find a static folder with TTF files for each weight and, for modern families, a variable font file that contains every weight in one file.
Convert to WOFF2 and subset (recommended)
The zip contains TTF files, which are larger than necessary for the web. WOFF2 is the compressed web font format supported by every current major browser, so it is the only format you need to ship. If you have Python available, fonttools converts and subsets in seconds:
pip install fonttools brotli
# Straight conversion
fonttools ttLib.woff2 compress Inter-Regular.ttf
# Convert + keep only Latin characters (Google's "latin" range)
pyftsubset Inter-Regular.ttf \
--unicodes="U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+0304,U+0308,U+0329,U+2000-206F,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD" \
--layout-features='*' \
--flavor=woff2 \
--output-file=inter-latin-400.woff2
Subsetting matters. A full family with Cyrillic, Greek, Vietnamese and Latin Extended can be several times larger than the Latin subset a typical English or Western European site needs. If your audience reads other scripts, keep those subsets too, otherwise visitors will see fallback glyphs.
Shortcut: fetch WOFF2 files straight from the API (once)
You can also let the Google Fonts API hand you ready-made WOFF2 files. Run this on your own computer or server, not in the visitor’s browser, so it is a one-time developer request and not part of your site’s page loads. Google serves WOFF2 when the request looks like a modern browser:
# 1) Get the CSS Google would serve to a modern browser
curl -s -H "User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/130.0 Safari/537.36" \
"https://fonts.googleapis.com/css2?family=Inter:wght@400;700&display=swap" -o inter.css
# 2) Download every WOFF2 URL listed in that CSS
grep -oE "https://fonts\.gstatic\.com[^)]+\.woff2" inter.css | sort -u | xargs -n1 curl -sO
The CSS lists one file per Unicode subset (latin, latin-ext, cyrillic and so on) and gives each a unicode-range. Keep the subsets you need and copy the @font-face rules as your starting point.
Static fonts vs variable fonts
| Type | What you get | Best for |
|---|---|---|
| Static | One file per weight and style (Regular, Bold, Italic…) | Sites using two or three weights; simplest @font-face rules |
| Variable | One file containing a weight range (for example 100 to 900) | Designs that use many weights or fine-tuned weights; often smaller than four or more static files |
How to Host Google Fonts Locally in WordPress
There are three hands-on ways to host Google Fonts locally in WordPress. They share the same ingredients (font files plus @font-face rules) and differ in where you put the files and how you register them. Pick the one that matches your comfort level:
| Method | Skill level | Best for | Catches fonts from other plugins? |
|---|---|---|---|
| 1. Manual download | Beginner | Getting the right files, the first step of every manual route | No |
| 2. Upload font files | Beginner to intermediate | Keeping fonts safe from theme updates | No |
| 3. Register with CSS | Intermediate | Full control, no extra plugin | No |
| Plugin (OMGF or similar) | Beginner | Sites where themes and plugins load fonts automatically | Yes |
Method 1: Download Google Fonts Manually
Follow the steps from the previous section: download the family, convert the weights you use to WOFF2 and rename the files so they are easy to recognise. A predictable naming pattern saves headaches later:
inter-latin-400.woff2
inter-latin-700.woff2
inter-latin-400-italic.woff2
inter-variable-latin.woff2
Keep a short note of the family, weights and subsets you downloaded, along with the license line from the Google Fonts page. It makes future audits and privacy documentation much easier.
Method 2: Upload Font Files to Your WordPress Website
Upload the WOFF2 files to a folder that survives theme updates. The uploads directory is a good home:
/wp-content/uploads/local-fonts/
- Connect with SFTP or open your host’s File Manager.
- Create
local-fontsinsidewp-content/uploads. - Upload the WOFF2 files. Use
644permissions for files and755for the folder. - Open one file’s URL in the browser, for example
https://example.com/wp-content/uploads/local-fonts/inter-latin-400.woff2. It should download rather than return a 404.
Why not use the Media Library? By default WordPress blocks most font file types in the Media Library upload screen, so SFTP or your host’s file manager is the reliable route. (The built-in Font Library, covered later, has its own uploader.)
Next, make sure your server sends fonts with the right type and a long cache lifetime. On Apache, add this to .htaccess:
AddType font/woff2 .woff2
<IfModule mod_headers.c>
<FilesMatch "\.woff2$">
Header set Cache-Control "public, max-age=31536000, immutable"
</FilesMatch>
</IfModule>
On Nginx, add a block inside your server configuration:
location ~* \.woff2$ {
add_header Cache-Control "public, max-age=31536000, immutable";
types { font/woff2 woff2; }
access_log off;
}
If you serve the files from a separate CDN hostname, the CDN must also send an Access-Control-Allow-Origin header allowing your site, because browsers fetch fonts in CORS mode across origins.
Method 3: Register Local Fonts Using CSS
Files on a server do nothing until the browser is told about them. Register each file with an @font-face rule, then use the family name in your styles:
@font-face {
font-family: "Inter";
font-style: normal;
font-weight: 400;
font-display: swap;
src: url("/wp-content/uploads/local-fonts/inter-latin-400.woff2") format("woff2");
unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
font-family: "Inter";
font-style: normal;
font-weight: 700;
font-display: swap;
src: url("/wp-content/uploads/local-fonts/inter-latin-700.woff2") format("woff2");
unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
body {
font-family: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
}
If you chose a variable font, one rule covers the whole weight range:
@font-face {
font-family: "Inter";
font-style: normal;
font-weight: 100 900;
font-display: swap;
src: url("/wp-content/uploads/local-fonts/inter-variable-latin.woff2") format("woff2");
}
Where do you paste this? On a classic theme use Appearance → Customize → Additional CSS. On a block theme open the Site Editor, go to Styles and use the Additional CSS panel. If you are new to this, our guide to adding custom CSS in WordPress walks through every option, including child themes and plugins.
@font-face in Additional CSS.A note on URLs: a root-relative path such as /wp-content/uploads/… works when WordPress lives at the domain root. On a subdirectory install or a multisite subfolder network, use the full URL so the browser finds the file.
How to Integrate Google Fonts Locally Using a WordPress Plugin
If your theme, page builder and a handful of plugins all request Google Fonts independently, finding every call by hand is tedious. A font-hosting plugin scans your pages, downloads the fonts it finds, rewrites the URLs and keeps the cache up to date. Two well-known options are OMGF and Local Google Fonts. WordPress itself also offers a built-in route through the Font Library.
Using OMGF (Host Google Fonts Locally)
OMGF is a free plugin from the WordPress.org directory, with changelog entries running into 2026. It looks for Google Fonts (and also Bunny Fonts and the Jetpack font CDN), downloads them to your server and serves them locally. The free version also lists fonts loaded by Elementor.
- Go to Plugins → Add New, search for OMGF, then install and activate it.
- Open Settings → Optimize Google Fonts.
- Visit a few pages of your site in a private window so the plugin can detect the fonts they request. It starts scanning as soon as pages are served.
- Return to the Optimize Local Fonts section and review the detected families and weights.
- Unload any family or weight you do not need and mark the one or two above-the-fold fonts for preloading.
- Choose a font-display value (swap is a sensible default) and click Save & Optimize.
- Clear your page cache and CDN cache, then verify using the steps in the verification section.
What makes OMGF useful on busy sites is detection and housekeeping: it can warn you when a theme or plugin update introduces a new Google Font, it has a performance checker that flags unused subsets, unused weights and missing preloads, and it lets you force a font-display value. The Pro tier adds deeper detection, such as fonts declared in inline <style> blocks, @import rules, Web Font Loader and fonts injected by JavaScript. If your audit in the earlier section found those patterns, plan for that.
Using Local Google Fonts
The Local Google Fonts plugin takes a simpler route. It finds the Google Fonts your site enqueues, downloads WOFF2 copies, serves them from your server and removes the DNS prefetch and preconnect hints that point to Google.
- Install and activate Local Google Fonts.
- Go to Settings → Google Fonts.
- Browse your website in another tab so the plugin can discover the fonts in use, then return to the settings page.
- Tick Load Fonts automatically (or trigger each font set manually) and click Reload Fonts.
- Save, clear caches and re-run the Network tab check.
Know its limits before you rely on it: it checks fonts added with wp_enqueue_style, so a font pulled in with @import has to be changed first. Divi has its own Google Fonts implementation, so the plugin’s documentation asks you to switch off Divi’s Improve Google Fonts Loading option in the Performance settings, and Slider Revolution has a built-in Cache Fonts Local setting you should enable. Also check the plugin’s “tested up to” version and last update date before installing, and compare it with alternatives if it looks stale for your WordPress version.
Using the built-in WordPress Font Library
Since WordPress 6.5, the core Font Library lets you add fonts from inside the Site Editor, either by uploading your own files or by installing families from a Google Fonts collection. When you install a family from that collection, WordPress downloads the files to your own server, so visitors load them from your domain and not from Google. That makes it a plugin-free way to use Google Fonts for WordPress block themes.
- Go to Appearance → Editor → Styles → Typography → Fonts.
- Open Manage fonts and choose the Install Fonts tab.
- Pick the family and the variants you need, then click Install.
- Assign the font to elements under Typography (text, links, headings, buttons).
The Font Library suits block themes best. For classic themes that print their own Google Fonts <link> tags, the Font Library will not remove those calls, so combine it with the clean-up steps in the next section. WordPress also bundles its default block themes with locally hosted fonts, a change explained in this core announcement: Google Fonts are included locally in bundled themes.
How to Disable External Google Fonts Requests in WordPress
Downloading the files is half the job. Your theme or a plugin will keep asking Google for the same fonts until you stop it. Work through these layers from the easiest to the most technical.
1. Turn it off at the source
Many themes and builders have a switch such as “Load Google Fonts locally” or “Disable Google Fonts”, or typography settings where you can choose a system or custom font instead. Check the theme options, the Customizer, your page builder’s global settings and each active plugin that outputs text (sliders, popups, forms, WooCommerce widgets). This is the cleanest fix because it survives updates.
2. Find the handle that loads Google Fonts
If there is no switch, find the stylesheet handle. Add this temporary snippet (a small custom plugin or a child theme’s functions.php), load a page and read wp-content/debug.log (with WP_DEBUG_LOG enabled):
add_action( 'wp_print_styles', function () {
global $wp_styles;
foreach ( $wp_styles->registered as $handle => $style ) {
if ( is_string( $style->src ) && false !== strpos( $style->src, 'fonts.googleapis.com' ) ) {
error_log( 'Google Fonts handle: ' . $handle . ' => ' . $style->src );
}
}
}, 100 );
3. Dequeue the stylesheet and print your local one
Replace theme-google-fonts with the handle you found and point the new stylesheet at the CSS file containing your @font-face rules:
add_action( 'wp_enqueue_scripts', function () {
wp_dequeue_style( 'theme-google-fonts' );
wp_deregister_style( 'theme-google-fonts' );
wp_enqueue_style(
'local-fonts',
content_url( '/uploads/local-fonts/fonts.css' ),
array(),
'1.0.0'
);
}, 20 );
Use a priority higher than the one your theme uses to enqueue the original style (20 works for most themes). If the handle is registered by a plugin, check the plugin documentation first, since some print the font link directly instead of enqueuing it.
4. Remove the DNS prefetch and preconnect hints
WordPress adds resource hints for Google domains whenever a Google Fonts stylesheet is enqueued, and some themes add their own. Filter them out so the browser does not even warm up a connection:
add_filter( 'wp_resource_hints', function ( $urls, $relation_type ) {
if ( in_array( $relation_type, array( 'dns-prefetch', 'preconnect' ), true ) ) {
$urls = array_filter( $urls, function ( $url ) {
$href = is_array( $url ) ? ( isset( $url['href'] ) ? $url['href'] : '' ) : $url;
return false === strpos( $href, 'fonts.googleapis.com' )
&& false === strpos( $href, 'fonts.gstatic.com' );
} );
}
return $urls;
}, 10, 2 );
5. Clean up hard-coded references
Search custom CSS, theme files and the database for @import url(https://fonts.googleapis.com or <link href="https://fonts.googleapis.com and delete or replace them with your local @font-face rules. Remember the block editor too: if the editor still loads Google Fonts, your admin users’ browsers call Google even though visitors do not. A plugin that rewrites fonts globally usually catches the editor as well.
6. Catch stragglers with a Content Security Policy report
A report-only CSP quietly tells you when any page still requests a font from another origin, without breaking anything:
Content-Security-Policy-Report-Only: font-src 'self'; report-uri /csp-report
Once the reports are clean for a few weeks, you can switch to an enforcing font-src 'self' policy so a future plugin update cannot silently bring Google Fonts back. Add the CDN hostname to font-src if you serve fonts from one.
How to Host Google Fonts Locally in a WordPress Theme
If you build or customise a theme, bundle the fonts with the theme so every install is self-contained. Never edit a third-party parent theme directly, because the next update overwrites your changes.
Using a child theme
Create a child theme in WordPress, then place your fonts and a small stylesheet inside it:
/wp-content/themes/your-child-theme/
├── style.css
├── functions.php
└── assets/
└── fonts/
├── fonts.css
├── inter-latin-400.woff2
└── inter-latin-700.woff2
Using @font-face in CSS
In a theme-bundled stylesheet, reference the files relative to the CSS file itself. This is the most portable approach because it keeps working when the site moves to a different path or domain:
/* assets/fonts/fonts.css */
@font-face {
font-family: "Inter";
font-style: normal;
font-weight: 400;
font-display: swap;
src: url("inter-latin-400.woff2") format("woff2");
}
@font-face {
font-family: "Inter";
font-style: normal;
font-weight: 700;
font-display: swap;
src: url("inter-latin-700.woff2") format("woff2");
}
Using functions.php
Enqueue that stylesheet from the child theme’s functions.php so it loads in the front end and in the block editor:
add_action( 'wp_enqueue_scripts', function () {
wp_enqueue_style(
'child-local-fonts',
get_stylesheet_directory_uri() . '/assets/fonts/fonts.css',
array(),
wp_get_theme()->get( 'Version' )
);
}, 5 );
// Load the same fonts inside the editor.
add_action( 'after_setup_theme', function () {
add_editor_style( 'assets/fonts/fonts.css' );
} );
Block themes: register fonts in theme.json
For block themes, the modern approach is to declare the font in theme.json. WordPress then generates the @font-face rules for you and shows the font in the Site Editor typography controls:
{
"$schema": "https://schemas.wp.org/trunk/theme.json",
"version": 3,
"settings": {
"typography": {
"fontFamilies": [
{
"fontFamily": "Inter, system-ui, sans-serif",
"name": "Inter",
"slug": "inter",
"fontFace": [
{
"fontFamily": "Inter",
"fontWeight": "400",
"fontStyle": "normal",
"fontDisplay": "swap",
"src": [ "file:./assets/fonts/inter-latin-400.woff2" ]
},
{
"fontFamily": "Inter",
"fontWeight": "700",
"fontStyle": "normal",
"fontDisplay": "swap",
"src": [ "file:./assets/fonts/inter-latin-700.woff2" ]
}
]
}
]
}
}
}
Version 3 of the theme.json schema needs a recent WordPress release. On older installs, set "version": 2 instead.
How to Preload Local Google Fonts for Better Performance
Hosting the files yourself removes the third-party hop. Preloading goes a step further by telling the browser to fetch the most important font while it is still reading the HTML, instead of waiting until the CSS has been parsed and a text node needs it. Read the MDN documentation on rel=”preload” for the full details.
Preload only what you need
Preload the one or two font files used in the first screen (usually the body text regular weight and the main heading weight). Preloading everything makes the browser download files it will not use immediately and can slow the page down.
add_action( 'wp_head', function () {
$fonts = array(
get_stylesheet_directory_uri() . '/assets/fonts/inter-latin-400.woff2',
get_stylesheet_directory_uri() . '/assets/fonts/inter-latin-700.woff2',
);
foreach ( $fonts as $font ) {
printf(
'<link rel="preload" href="%s" as="font" type="font/woff2" crossorigin>' . "\n",
esc_url( $font )
);
}
}, 1 );
The crossorigin attribute is required for font preloads even when the file is on your own domain. Without it the browser downloads the file twice, once for the preload and again for the real use.
Pick the right font-display value
| Value | Behaviour | Use it when |
|---|---|---|
swap |
Shows fallback text immediately, swaps when the font arrives | Body text and most sites (safe default) |
fallback |
Very short block period, short swap window | You want less visible swapping on slower connections |
optional |
Uses the font only if it is already available quickly | Decorative fonts where stability matters more than the exact typeface |
block |
Hides text briefly, then swaps | Icon fonts and logos only |
The full list and browser behaviour are documented on MDN’s font-display reference.
Reduce layout shift with a tuned fallback
When swap replaces a fallback font with your web font, text can reflow if the two have different proportions. You can describe a local fallback so it occupies the same space. The numbers below are only an illustration, so measure your own pair (with a font metrics tool or your browser’s DevTools) before copying them:
@font-face {
font-family: "Inter Fallback";
src: local("Arial");
size-adjust: 107%;
ascent-override: 90%;
descent-override: 22%;
line-gap-override: 0%;
}
body {
font-family: "Inter", "Inter Fallback", system-ui, sans-serif;
}
Other performance wins
- Subset and limit weights. Every extra weight is another file. Drop the ones you do not use.
- Cache aggressively. Use the one-year
immutableheaders from earlier and version file names if you ever replace a file. - Serve over HTTP/2 or HTTP/3 and put fonts on the same CDN as your other static assets.
- Purge caches after the switch. Page caches and CDNs keep serving old HTML that still points to Google.
How to Verify Google Fonts Are Loading Locally
Finish every job with proof. Repeat the same checks you ran before you started:
- Network tab. Open DevTools in a private window, tick Disable cache, reload and filter by Font. Every row should show your domain (or your CDN) and none should show
fonts.gstatic.com. Clear the filter and search the request list forgoogleapisto confirm no stylesheet slipped through. Figure 2 shows the target state. - Rendered fonts. Inspect a heading and a paragraph, open the Computed tab and look for Rendered Fonts. It should name your family and mention a network resource, not a missing fallback.
- View source. Search the page source for
googleapis,gstaticandpreconnect. You should find nothing. - Command line. Re-run the
curl | grepfrom earlier and confirm it returns no lines. Check the headers of a font file:curl -sI https://example.com/wp-content/uploads/local-fonts/inter-latin-400.woff2 | grep -iE "HTTP/|content-type|cache-control"You want
200,font/woff2and a longmax-age. - Test more than the homepage. Check a post, a category archive, a WooCommerce product, the cart and checkout, the login page and a 404 page. Plugins often load fonts only on specific templates.
- Test logged in and logged out, in at least two browsers, and again after clearing every cache layer.
- Watch your CSP reports (if you set one up) for a couple of weeks.
Common Google Fonts Loading Problems and How to Fix Them
| Problem | Likely cause | Fix |
|---|---|---|
Site still requests fonts.gstatic.com |
A plugin, builder or @import loads fonts on its own |
Use the handle-finding snippet, search the database and CSS, or use a plugin that detects builder fonts |
| Font does not change after the switch | Page cache or CDN serving old HTML | Purge the page cache, CDN cache and browser cache, then retest |
| Font file returns 404 | Wrong path in @font-face, or file not uploaded |
Open the file URL directly, fix the path, check capitalisation on Linux servers |
| Font blocked, CORS error in the console | Fonts on a CDN hostname without CORS headers | Send Access-Control-Allow-Origin for your site from the CDN |
| Text flashes or jumps when fonts load | Fallback has different metrics, no preload | Preload the key file, use font-display: swap with a tuned fallback |
| Bold or italic looks fake (faux bold) | The matching weight or style file is missing | Add the real file and an @font-face rule with the right font-weight and font-style |
| Accents, Cyrillic or Greek letters look wrong | Subset too narrow | Include the extra subset (latin-ext, cyrillic, greek, vietnamese) with its unicode-range |
| Icons turn into squares or words | Icon font (for example Material Icons) was not localised | Host the icon font file too, or use a plugin that supports icon fonts |
| Fonts work on the front end but not in the editor | Editor styles not loaded | Use add_editor_style() or register the fonts in theme.json |
| Plugin stopped working after an update | Cached local copies of third-party CSS are stale | Flush the plugin’s font cache and re-run its optimization, then clear page caches |
| Multisite subsites load wrong paths | Root-relative URLs on subdirectory networks | Use theme-relative URLs in the CSS or full URLs |
Best Practices for GDPR-Friendly Font Hosting
- Host every font file yourself (or on a CDN you control) and avoid third-party font CDNs unless you have a documented reason.
- Audit all templates, not only the homepage, after every theme, plugin or builder change.
- Use as few families and weights as the design needs, and subset to the scripts your visitors read.
- Keep a short inventory: family, weights, license link and file locations.
- Serve fonts with long-lived cache headers and the correct MIME type.
- Add a report-only Content Security Policy for
font-src, then enforce it once reports are clean. - Remember that fonts are only one third-party request. Maps, video embeds, reCAPTCHA, analytics and social widgets can raise the same privacy questions, so review them too.
- Describe your approach honestly in your privacy documentation and review it with someone qualified.
- Schedule a quick re-scan every quarter or after any major update.
- Back up the font folder with the rest of your site, so a migration or restore never brings Google calls back.
Frequently Asked Questions
Is hosting Google Fonts locally GDPR compliant?
Self-hosting removes the font request to Google, which is the practice criticised in the 2022 Munich ruling, so it is the approach most privacy advisers recommend. Full GDPR compliance depends on your whole site (analytics, embeds, forms, cookies), not just fonts, so treat it as one important piece.
Can I use Google Fonts for free on a commercial website?
Yes. Most Google Fonts families use open licenses that allow commercial use and self-hosting. Always read the license on the specific family’s page before you bundle it.
Does hosting Google Fonts locally make my site faster?
Often, yes. You avoid extra DNS and connection setup for two Google domains, you can preload the key file and you control caching and subsetting. The gain is largest on sites that load several families or weights and on mobile connections. Because browsers now partition their caches by site, you also give up very little by leaving the shared Google cache behind.
How do I host Google Fonts locally in WordPress without a plugin?
Download the family, convert it to WOFF2, upload it to your site, register it with @font-face and remove the original Google Fonts stylesheet and resource hints. The manual methods in this guide walk through each step, and block themes can use the Font Library or theme.json.
Which font file format should I use?
WOFF2. It is compressed, supported by all current major browsers and the only format you need for new sites. Skip legacy formats unless you must support very old browsers.
Do I need to update locally hosted Google Fonts?
Rarely. Fonts change only when their designers publish a new version. Re-download a family occasionally if you want the latest glyph fixes, and version the file name when you replace it so browsers fetch the new file.
Why does my site still load Google Fonts after I installed a plugin?
Usually another source calls Google: a page builder font, inline CSS, an @import, a JavaScript loader or a page cache still serving old HTML. Run the checks in this guide, purge all caches and look at the plugin’s detection notes.
Will local fonts work with Elementor, Divi and other page builders?
Yes, but each builder has its own font loader. Check the builder’s global settings for a local-fonts or disable-Google-Fonts option first. For sites with several loaders, a scanning plugin is the most reliable route.
How many fonts should I host?
Two families and two to four weights are enough for most sites. Each extra file adds weight to the page, so add more only when the design truly needs them.
Does the WordPress Font Library host Google Fonts locally?
Yes, for fonts you install through it. Installing a family from the Google Fonts collection downloads the files to your server, so visitors load them from your domain. It does not remove Google Fonts that a classic theme or plugin still prints on its own.
Final Thoughts
Learning how to integrate Google Fonts locally in WordPress takes an afternoon, and it pays off for years. You protect your visitors’ privacy, remove two third-party requests from every page, gain control over caching and subsetting and make your typography independent of someone else’s servers.
The short version: audit what your site loads today, download only the WOFF2 files you need, host them on your own domain, register them with @font-face or theme.json, remove the old stylesheet and resource hints, preload the first-screen font and verify in the Network tab. If your site relies on many plugins and builders, let a plugin such as OMGF do the detection and keep a quarterly re-scan on your calendar.
Do it once, test it properly and your Google Fonts in WordPress setup becomes faster, more private and easier to maintain.
