Typography on the web with the Font Library

The Font Library makes it easier to manage fonts in WordPress. Here is how to use it well, with notes on performance, privacy and readable type.

Typography carries most of a website’s personality, yet for years fonts in WordPress meant hand-written CSS, a plugin, or a link to a third-party service. The Font Library, which arrived around WordPress 6.5, brings font management into the Site Editor. You can install, activate and remove fonts from within the interface, and the choices flow into the same style system as everything else.

What the Font Library does

In the Site Editor’s styles panel, the typography section lets you browse fonts, upload font files and activate the families and weights you need. Uploaded fonts are stored on your own server, so visitors do not need to contact an outside provider to see your text. Themes can also bundle fonts and declare them in theme.json.

Here is a minimal declaration of a locally hosted font family in a theme:

{
  "version": 3,
  "settings": {
    "typography": {
      "fontFamilies": [
        {
          "slug": "body-sans",
          "name": "Body Sans",
          "fontFamily": "\"Body Sans\", system-ui, sans-serif",
          "fontFace": [
            {
              "fontFamily": "Body Sans",
              "fontWeight": "400",
              "fontStyle": "normal",
              "fontDisplay": "swap",
              "src": ["file:./assets/fonts/body-sans-regular.woff2"]
            }
          ]
        }
      ]
    }
  }
}

Note the fallback stack after the font name. If the file fails to load, the browser uses a system font rather than showing nothing, and font-display: swap keeps text visible while the file arrives.

Choosing fonts sensibly

ApproachStrengthsWatch out for
System font stackNo download, fast, familiar to usersAppearance differs across devices
Self-hosted web fontsConsistent look, no third-party requestsYou manage files and licences
Variable fontsOne file covers many weightsLarger single file; check browser and tool support
External font serviceConvenient catalogueExtra requests and privacy considerations

Performance and privacy

  • Use WOFF2. It is widely supported and compresses well.
  • Limit weights and styles. Each one is another file. Two or three well-chosen variations are usually enough.
  • Self-host where you can. Serving fonts from your own domain avoids sending visitors’ requests to another company, which many site owners prefer for privacy reasons.
  • Check licences. Not every font may be embedded on the web or redistributed in a theme. Read the licence before uploading.

Readable type, not just attractive type

Font choice is only part of the picture. Body text generally reads best at around 16 pixels or larger, with a line height noticeably greater than the font size, and a line length that stays comfortable rather than stretching across a wide screen. Using relative units such as rem respects visitors who raise their browser’s default size. Keep headings in a clear hierarchy, avoid long stretches of capitals or tightly letter-spaced text, and test with real content rather than short placeholder lines.

Pair fonts with restraint. One family for headings and another for body is plenty, and a single family in several weights is often better still. If two typefaces look similar but not identical, the result tends to look like a mistake rather than a choice.

A practical workflow

Decide on a type scale first, define it as font size presets in theme.json, then add fonts to match. Test on a slow connection and a small phone, and check that your fallback stack looks acceptable in case a file does not load. Revisit the setup whenever a redesign is planned, since unused fonts accumulate quietly and cost every visitor time.

A Greater Star

Need help with your WordPress site?

The people behind this site build and look after WordPress sites every day at A Greater Star – new sites, custom plugins, support agreements, hosting, security and speed.