---
title: "Google Font Localization"
url: "https://docs.speedinchinaplugin.com/features/google-font-localization/"
---
## Why Localize Google Fonts?

Google services — including `fonts.googleapis.com` and `fonts.gstatic.com` — are blocked by the Great Firewall of China. When your WordPress theme or plugins load Google Fonts, Chinese visitors experience timeouts and broken typography. This can add **10–30 seconds** to page load times or cause the page to hang entirely.

Speed in China solves this by downloading the font files from Google and serving them **directly from your own server**. Chinese visitors load the fonts from your domain instead of Google's blocked servers.

## Enabling Google Font Localization

Go to **Speed in China → Optimizations** in your WordPress admin.

Find the **Google Font Localization** section.

Toggle the setting to **Enable**.

Once enabled, the plugin immediately begins intercepting Google Font requests on page load.

## How It Works

When Google Font localization is enabled, the plugin does the following on every page load:

1.  **Scans enqueued stylesheets** — Checks all WordPress-registered CSS files for URLs containing `fonts.googleapis.com` or `fonts.gstatic.com`.
2.  **Downloads the CSS** — Fetches the Google Fonts CSS file (using a browser-like User-Agent to get modern `woff2` format).
3.  **Downloads individual font files** — Parses the CSS and downloads each referenced font file from `fonts.gstatic.com`.
4.  **Saves locally** — Stores everything in `wp-content/uploads/sic-fonts/` with content-hashed filenames.
5.  **Rewrites URLs** — Replaces the original Google Font URLs with your local server URLs throughout the CSS.

**This feature is free.** Google Font localization is available on all plans, including the free version.

### Caching & Auto-Refresh

Downloaded font files are cached on your server for **30 days**. After 30 days, the next page load will re-download fresh copies. This ensures you always have up-to-date font files without manual intervention.

The cache directory is: `wp-content/uploads/sic-fonts/`

### Font Detection

The plugin detects Google Fonts loaded by any source — your theme, plugins, or even manual enqueues. It scans both frontend (`wp_enqueue_scripts`) and admin (`admin_enqueue_scripts`) hooks.

Detected fonts are shown in the Optimizations tab, listing each font's handle (WordPress stylesheet handle), URL, and detected font families.

## Clearing the Font Cache

To force a fresh download of all font files:

Go to **Speed in China → Optimizations**.

Click the **Clear Font Cache** button.

This deletes all files in `wp-content/uploads/sic-fonts/`. Fonts will be re-downloaded on the next page load.

## Disabling Localization

Toggle the setting back to **Disable** in the Optimizations tab. Google Fonts will revert to loading from Google's servers. The local font files remain in the cache directory but are no longer used. You can manually delete `wp-content/uploads/sic-fonts/` via FTP/SFTP if desired.

**Hardcoded Google Fonts** — If your theme loads Google Fonts via hardcoded `<link>` tags in the HTML (instead of using WordPress's `wp_enqueue_style`), the plugin cannot detect or replace those. Check with your theme developer if fonts still load from Google after enabling localization.
