Guide · Updated October 2026

How to Keep Google Fonts Working After Website Conversion to WordPress

To keep Google Fonts working after converting a website to a WordPress theme, you must ensure their stylesheet links are correctly enqueued in your theme's `functions.php` file and referenced in your `style.css`. This process guarantees the fonts load properly on your new WordPress installation.

Do it yourself in about a minute

Install Themify and get your first conversion free — no credit card.

Chrome browser logoAdd to Chrome — free

Understanding How Google Fonts Load in WordPress

When you convert a static website or a live webpage into a WordPress theme, one of the most common issues designers face is ensuring that custom fonts, particularly Google Fonts, continue to load as intended. On a static HTML page, you typically link to Google Fonts directly in the `<head>` section of your `index.html` file using a `<link>` tag. For example, `<link href="https://fonts.googleapis.com/css2?family=Roboto:wght@400;700&display=swap" rel="stylesheet">`.

WordPress, however, uses a different system for managing assets like stylesheets and scripts, including font stylesheets. It leverages a process called "enqueuing." Enqueuing scripts and styles ensures they are loaded efficiently, in the correct order, and without conflicts. Directly pasting `<link>` tags into `header.php` can work, but it's not the recommended or most robust method for theme development. The proper way is to use the `wp_enqueue_style()` function within your theme's `functions.php` file.

Identifying Google Font Imports in Your Converted Theme

After converting your webpage to a WordPress theme (whether manually or using a tool like Themify), the first step is to locate how Google Fonts were originally referenced. This information is crucial for correctly migrating them to WordPress's enqueuing system.

Your converted theme will contain several core files. The most likely places to find Google Font references are:

Once you've identified these references, extract the full URL for the Google Fonts stylesheet. It will look something like `https://fonts.googleapis.com/css2?family=Open+Sans:wght@300;400;700&display=swap`.

  • **`style.css`:** Sometimes, particularly if the original site used `@import` rules, you'll find `@import url('https://fonts.googleapis.com/css2?family=...');` at the very top of your main stylesheet.
  • **`header.php` (or similar file in older conversions):** If the conversion tool tried to preserve the exact HTML structure, you might find the `<link>` tag directly within the `<head>` section of `header.php`.

The Core Solution: Enqueuing Google Fonts in `functions.php`

The most reliable and WordPress-native way to load Google Fonts is by enqueuing them. This involves adding a function to your theme's `functions.php` file.

Navigate to your theme directory (e.g., `wp-content/themes/your-theme-name/`). Open the `functions.php` file in a code editor. If it doesn't exist, you'll need to create it. Then, add the following code block, replacing the example URL with your specific Google Fonts URL:

  1. **Create a custom function:** Define a new PHP function, for example, `yourtheme_enqueue_google_fonts()`.
  2. **Use `wp_enqueue_style()`:** Inside this function, call `wp_enqueue_style()`. This function takes several parameters: a unique handle (e.g., `'google-fonts-open-sans'`), the URL of the stylesheet, an array of dependencies (usually empty for fonts), the version number (optional, often `null`), and the media type (optional, `'all'` is common).
  3. **Hook the function:** Attach your custom function to the `wp_enqueue_scripts` action hook. This hook fires at the correct time for enqueuing styles and scripts on the front-end.
  4. **Example `functions.php` code:**
  5. ```php <?php function yourtheme_enqueue_google_fonts() { wp_enqueue_style( 'google-fonts-open-sans', 'https://fonts.googleapis.com/css2?family=Open+Sans:wght@300;400;700&display=swap', [], null ); } add_action( 'wp_enqueue_scripts', 'yourtheme_enqueue_google_fonts' ); // Add other theme functions below this. ?> ```
  6. **Save the file:** Upload `functions.php` back to your theme directory. WordPress will automatically execute this code.

Removing Duplicate or Incorrect Font Imports

If your fonts are still not rendering correctly or are loading multiple times (which can impact performance), you likely have duplicate font declarations. After implementing the `functions.php` solution, you must remove any old, static references.

Review these files in your theme: `header.php`, `style.css` (specifically for `@import` rules), and any other template files that might contain direct `<link>` tags or `@import` statements for Google Fonts. Remove any instances you find. For example, if you find `<link href="https://fonts.googleapis.com/css2?family=Roboto..." rel="stylesheet">` in `header.php`, delete that line. If you see `@import url('https://fonts.googleapis.com/css2?family=...')` at the top of `style.css`, remove it.

Verifying Google Fonts Are Loading Correctly

After making these changes, it's crucial to verify that your Google Fonts are loading as expected on your WordPress site. This involves using browser developer tools, which are available in Chrome, Firefox, Safari, and Edge.

On your WordPress site, right-click anywhere on the page and select "Inspect" (or "Inspect Element"). This will open the developer console.

**Navigate to the Network Tab:** Refresh the page with the console open. In the Network tab, filter by "CSS" or search for "fonts.googleapis.com". You should see requests for your Google Fonts stylesheet(s) with a status code of 200 (OK). If you see multiple requests for the same font family, you may still have duplicates. If you don't see any, the enqueuing might not be working.

**Navigate to the Elements Tab:** Select an element on your page that should be using a Google Font (e.g., a heading or paragraph). In the Styles pane of the Elements tab, check the computed styles. You should see your Google Font listed in the `font-family` property. If a fallback font is listed first and applied, it means the Google Font isn't loading.

**Check the Console Tab:** Look for any errors related to fonts, CSS, or mixed content (if your site is HTTPS but a font is requested via HTTP).

Ensuring the correct font weight and style variations are included in your Google Fonts URL (e.g., `wght@400;700` for regular and bold) is also vital. If your CSS requests a specific weight that isn't included in the URL, that weight might not display correctly, leading to unexpected font rendering.

Troubleshooting Common Google Fonts Issues After Conversion

Even with careful steps, you might encounter issues. Here are common problems and their solutions:

The process of converting a live webpage into a WordPress theme often involves migrating various assets, including custom fonts. Tools like Themify simplify this by attempting to carry over as much styling as possible, but for robust, long-term theme functionality, a manual review and correct implementation of Google Fonts via `functions.php` is often necessary. This ensures your site maintains its design integrity and performs optimally on the WordPress platform.

  • **Fonts not loading at all:** Double-check your `functions.php` for typos in `wp_enqueue_style()` parameters, especially the URL and handle. Ensure the `add_action` hook is correctly placed and spelled. Clear any caching plugins.
  • **Fonts look different (wrong weight/style):** Verify that the Google Fonts URL in `functions.php` includes all necessary `wght` and `ital` parameters (e.g., `family=Roboto:wght@400;700&display=swap`). Your CSS should then correctly target these weights (e.g., `font-weight: 700;`).
  • **Flash of unstyled text (FOUT):** This often happens when fonts are loaded late. While not always preventable for external fonts, ensure your font declaration is as high as possible in the `functions.php` `wp_enqueue_scripts` hook. Using `&display=swap` in your Google Fonts URL can mitigate FOUT by telling the browser to use a fallback font first and swap it once the Google Font loads.
  • **Mixed Content Warnings (HTTPS sites):** If your site is HTTPS but you inadvertently used an HTTP Google Fonts URL, browsers will block the font. Always use `https://` for Google Fonts URLs. WordPress usually handles this automatically if you use protocol-relative URLs (`//fonts.googleapis.com...`), but explicitly using `https://` is safer.
  • **Caching Issues:** After making changes, clear your browser cache, any WordPress caching plugins (e.g., WP Rocket, W3 Total Cache, LiteSpeed Cache), and server-side caches. Old CSS or font files can prevent new changes from appearing.
  • **Font issues on specific pages only:** This could indicate a template-specific issue. Check the `header.php` or `functions.php` of child themes or custom templates that might be overriding the main theme's font declarations.

Frequently asked questions

Why do Google Fonts stop working after converting a website to WordPress?
Google Fonts stop working because WordPress uses its own asset management system, `wp_enqueue_style()`, which needs to be explicitly told to load the font stylesheets. Direct HTML `<link>` tags or CSS `@import` rules from the original site may not be parsed or executed correctly by WordPress.
Can I just paste the Google Fonts `<link>` tag into my WordPress theme's `header.php`?
While pasting the `<link>` tag into `header.php` might work in some cases, it is not the recommended WordPress practice. Using `wp_enqueue_style()` in `functions.php` ensures proper dependency management, caching, and compatibility with other plugins and themes, making your theme more robust and future-proof.
How can I prevent a "flash of unstyled text" (FOUT) with Google Fonts?
To mitigate FOUT, include `&display=swap` at the end of your Google Fonts URL (e.g., `...&display=swap`). This CSS property tells the browser to immediately display a fallback font while the Google Font is loading, and then swap it in once it's available, improving user experience.
What if my converted site uses multiple Google Font families?
If your site uses multiple Google Font families, you can combine them into a single `wp_enqueue_style()` call by adding more `&family=` parameters to the URL (e.g., `...family=Open+Sans&family=Roboto...`). Alternatively, you can enqueue each font family separately using its own `wp_enqueue_style()` call with a unique handle within the same `yourtheme_enqueue_google_fonts()` function.

Try it in minutes — first conversion free

Themify is the fastest way to turn any live webpage into an installable WordPress theme (.zip). No coding, no rebuilding, no design handoff. Runs 100% locally in your browser.

No credit card required · 14-day money-back guarantee

Chrome browser logoAdd to Chrome — 1 free conversion