The Hassle-Free Way to Host Fonts Locally in WordPress (2023 Guide)

Hey there, WordPress user! 👋 Want to speed up your website and avoid legal issues by hosting your fonts locally? You‘re in the right place.

Using custom fonts can give your WordPress site a unique and professional look. But if you‘re not careful, they can also slow things down and even put you at risk of violating privacy laws. 😬

Don‘t worry though! In this post, I‘ll walk you through exactly how to host your fonts locally for maximum performance and legal compliance. No technical expertise needed.

Why You Should Host Your WordPress Fonts Locally

Before we jump into the how-to, let‘s talk about why you should host your fonts locally in the first place. Here are three big reasons:

  1. Faster loading times. When you host fonts on your own server, visitors‘ browsers don‘t have to make extra requests to third-party sites to download them. This can shave precious seconds off your page load times.

    How much faster are we talking? In a test by WP Rocket, replacing Google Fonts with local copies improved page load times by 1 second. That may not sound like much, but a 1 second delay can hurt conversions by 7% according to Neil Patel.

  2. GDPR compliance. If you use Google Fonts on your WordPress site, you might be violating the EU‘s General Data Protection Regulation (GDPR). That‘s because Google Fonts tracks visitors‘ IP addresses, which legally counts as personally identifiable data under GDPR.

    So if any EU residents visit your Google Fonts-using site, you could be risking fines and legal action. 😱 Hosting fonts locally avoids this issue entirely.

  3. More control. With self-hosted fonts, you‘re not at the mercy of third-party hosting services. You control the font files, so there‘s no risk of them suddenly becoming unavailable and breaking your site‘s design.

    Want to use a custom version of a font, or combine multiple font files? Hosting locally makes it easy. You have complete freedom over your WordPress typography.

Sold on the benefits of local fonts? Great! Let‘s look at how to actually implement them on your site.

How to Host Fonts Locally in WordPress (2 Methods)

There are two main ways to host fonts locally in WordPress:

  1. Use the OMGF plugin to automatically host Google Fonts locally
  2. Manually upload font files to your server and link them in your theme‘s CSS

Unless you have a specific reason to host fonts manually, I recommend using the OMGF plugin. It‘s much easier to set up and maintain, especially for beginners.

Method 1: Automatically Host Google Fonts Locally With OMGF

The free OMGF plugin makes hosting Google Fonts locally a breeze. Here‘s how to use it:

  1. Install and activate the plugin. You can find it by searching for "OMGF" under Plugins → Add New in your WordPress dashboard.

  2. Configure the plugin settings. Head to Settings → Optimize Google Fonts to customize how OMGF handles your fonts.

    For most sites, the default settings will work great out of the box. The only option you may want to change is Font-Display, which controls how the loaded fonts are rendered. When in doubt, stick to the Swap option, which displays a fallback font until yours is ready.

    The OMGF plugin settings screen

  3. Click the Save & Optimize button to download your Google Fonts and start hosting them locally. And that‘s it! You should now see a "Success" message confirming the optimization.

From now on, your WordPress theme and plugins will load Google Fonts from your own server rather than Google‘s. Faster font loading and better legal compliance with zero extra effort!

Method 2: Manually Add Local Fonts to WordPress

If you want to use fonts that aren‘t available on Google Fonts, or just prefer a DIY approach, you can host your font files manually. Here‘s how:

  1. Find and download web font files in formats like WOFF2, WOFF, and TTF. Good sources for free fonts include Google Fonts, Font Squirrel, and DaFont.

    If you have existing font files in other formats like OTF, you can convert them using Font Squirrel‘s Webfont Generator or Transfonter.

  2. Upload the font files to your WordPress site using FTP or your hosting panel‘s file manager. I recommend putting them in a /fonts/ directory in your (child) theme folder to keep things organized.

  3. Load the fonts in your theme‘s CSS using the @font-face rule. For example:

    @font-face {
      font-family: ‘My Awesome Font‘;
      src: url(‘fonts/my-awesome-font.woff2‘) format(‘woff2‘);
      font-weight: normal;
      font-style: normal;
      font-display: swap;
    }

    The font-display: swap line here is optional, but tells browsers to show a fallback font while yours loads to avoid any jarring empty spaces.

    You can add these @font-face rules to your theme‘s stylesheet or the Additional CSS area in the WordPress Customizer under Appearance → Customize.

  4. Apply the custom font to elements in your CSS by referencing the name you used for font-family. To use our example font for all h1 headings:

    h1 {
      font-family: ‘My Awesome Font‘, sans-serif;
    }

    It‘s a good idea to include a generic fallback font like sans-serif or serif in case there are any issues loading your custom font.

That covers the two main methods for hosting local fonts on WordPress! The manual method offers more flexibility, but OMGF is definitely the simpler solution if you‘re already using Google Fonts.

Frequently Asked Questions About Local WordPress Fonts

Before we go, let‘s address some common questions you may have about self-hosting fonts in WordPress.

What are the best fonts to use on WordPress?

This depends a lot on your site‘s style and audience. But in general, sans-serif fonts tend to work well for headings and serif fonts for body text.

Some of the most popular fonts used on WordPress sites include:

  • Open Sans
  • Roboto
  • Lato
  • Montserrat
  • Source Sans Pro
  • Merriweather
  • Raleway
  • Oswald

When in doubt, stick to clean, legible fonts that complement your site‘s design. And try to use no more than 2-3 fonts to avoid visual clutter.

How do I know what fonts my WordPress theme is using?

Your WordPress theme‘s font settings will depend on the specific theme. Some common places to check:

  • WordPress Customizer: Look for typography settings under Appearance → Customize
  • Theme settings: Many themes have a dedicated typography settings page
  • Embedded CSS: Check inside your theme‘s tag for a pointing to Google Fonts

You can also use your browser‘s inspector tool to see what fonts are being applied to a specific element:

Using Chrome's inspector to see fonts

Can I use Adobe Fonts or other paid fonts in WordPress?

Yes! As long as you have the necessary license and permission from the font creator, you can use our manual font hosting method with any custom fonts.

Just make sure you‘re allowed to use the fonts on your website before uploading them to your server. Otherwise you could risk legal issues down the line.

Do I need to optimize my local font files?

For the best performance, it‘s a good idea to optimize your font files to be as small as possible. Some ways to do this:

  • Use modern compressed formats like WOFF2 instead of older ones like EOT
  • Subset your fonts to only include the characters and styles you actually need
  • Use a tool like Font Squirrel‘s Webfont Generator to compress and optimize your font files

Well-optimized fonts can often cut your font files sizes by 75% or more compared to the raw versions!

Host Your WordPress Fonts Locally Today

Wow, you made it to the end! 🙌 I know that was a lot to take in. But I hope you feel confident and excited to host your WordPress fonts locally now.

To recap, using fonts hosted on your own WordPress server can help you:

  • ⚡️ Speed up your page loading times
  • 🔐 Avoid GDPR legal issues from Google Fonts
  • 💪 Have complete control over your site‘s typography

For easiest local font hosting, install the OMGF plugin and let it handle everything with a few clicks. If you need more customization, you can upload your own font files and add them to your CSS manually.

However you choose to implement local fonts, your WordPress site (and visitors) will thank you. Faster, more compliant, and better looking—it‘s a no-brainer!

Have any other questions about WordPress fonts? Let me know in the comments. Happy font hosting!

References

Did you like this post?

Click on a star to rate it!

Average rating 0 / 5. Vote count: 0

No votes so far! Be the first to rate this post.