Title: How to register custom font collections for the Font Library
Author: Justin Tadlock
Published: April 1, 2024

---

 * [Showcase](https://wordpress.org/showcase/)
 * [Plugins](https://wordpress.org/plugins/)
 * [Themes](https://wordpress.org/themes/)
 * [Hosting](https://wordpress.org/hosting/)
 * [News](https://wordpress.org/news/)
    - [Learn WordPress](https://learn.wordpress.org/)
    - [Documentation](https://wordpress.org/documentation/)
    - [Education](https://wordpress.org/education/)
    - [Forums](https://wordpress.org/support/forums/)
    - [Developers](https://developer.wordpress.org/)
    - [Blocks](https://wordpress.org/blocks/)
    - [Patterns](https://wordpress.org/patterns/)
    - [Photos](https://wordpress.org/photos/)
    - [Openverse ︎](https://openverse.org/)
    - [WordPress.tv ︎](https://wordpress.tv/)
 *  - [About WordPress](https://wordpress.org/about/)
    - [Make WordPress](https://make.wordpress.org/)
    - [Events](https://events.wordpress.org/)
    - [Five for the Future](https://wordpress.org/five-for-the-future/)
    - [Enterprise](https://wordpress.org/enterprise/)
    - [Gutenberg ︎](https://wordpress.org/gutenberg/)
    - [Job Board ︎](https://jobs.wordpress.net/)
 * [Swag ︎](https://mercantile.wordpress.org/)
 * [Get WordPress](https://wordpress.org/download/)

Search in WordPress.org

 [ Get WordPress ](https://wordpress.org/download/)

[WordPress Developer Blog](https://developer.wordpress.org/news)

How to register custom font collections for the Font Library

 * [Snippets](https://developer.wordpress.org/news/snippets/)
    - [Blocks](https://developer.wordpress.org/news/category/blocks/)
    - [Concepts](https://developer.wordpress.org/news/category/concepts/)
    - [Common APIs](https://developer.wordpress.org/news/category/common-apis/)
    - [Design](https://developer.wordpress.org/news/category/design/)
    - [Playground](https://developer.wordpress.org/news/category/playground/)
    - [Plugins](https://developer.wordpress.org/news/category/plugins/)
    - [Themes](https://developer.wordpress.org/news/category/themes/)
 *  - [About this site](https://developer.wordpress.org/news/about/)
    - [Updates](https://developer.wordpress.org/news/category/updates/)
    - [How to contribute](https://developer.wordpress.org/news/how-to-contribute/)
    - [Tips and guidelines](https://developer.wordpress.org/news/tips-and-guidelines-for-writers/)
 * [Subscribe](https://developer.wordpress.org/news/subscribe/)
 * [Developer Resources](https://developer.wordpress.org/)

 * [Snippets](https://developer.wordpress.org/news/snippets/)
    - [Blocks](https://developer.wordpress.org/news/category/blocks/)
    - [Concepts](https://developer.wordpress.org/news/category/concepts/)
    - [Common APIs](https://developer.wordpress.org/news/category/common-apis/)
    - [Design](https://developer.wordpress.org/news/category/design/)
    - [Playground](https://developer.wordpress.org/news/category/playground/)
    - [Plugins](https://developer.wordpress.org/news/category/plugins/)
    - [Themes](https://developer.wordpress.org/news/category/themes/)
 *  - [About this site](https://developer.wordpress.org/news/about/)
    - [Updates](https://developer.wordpress.org/news/category/updates/)
    - [How to contribute](https://developer.wordpress.org/news/how-to-contribute/)
    - [Tips and guidelines](https://developer.wordpress.org/news/tips-and-guidelines-for-writers/)
 * [Subscribe](https://developer.wordpress.org/news/subscribe/)
 * [Developer Resources](https://developer.wordpress.org/)

# How to register custom font collections for the Font Library

By [Justin Tadlock](https://profiles.wordpress.org/greenshady/)

April 1, 2024

[Plugins](https://developer.wordpress.org/news/category/plugins/), [Themes](https://developer.wordpress.org/news/category/themes/)

WordPress 6.5 will ship the [long-awaited Font Library](https://make.wordpress.org/core/2024/03/14/new-feature-font-library/),
a feature that lets you manage fonts directly from the Site Editor. On the surface,
this might primarily seem like a user-facing tool, but there are several developer
goodies in the mix too.

In this post, you will learn how to register a custom font collection. This is a
sub-feature of the Font Library that lets you define sets of fonts that your theme
or plugin users can install on their site. Then they can further customize their
typography by using these fonts via the **Styles** panel or directly in posts, templates,
and patterns.

By default, WordPress ships with a single collection that lets you install fonts
from the Google Fonts library. But as a developer, you can offer a more curated 
experience by building custom collections.

Table of Contents

 1. [How font collections work](https://developer.wordpress.org/news/2024/04/01/how-to-register-custom-font-collections-for-the-font-library/#how-font-collections-work)
 2. [Registering font collections](https://developer.wordpress.org/news/2024/04/01/how-to-register-custom-font-collections-for-the-font-library/#registering-font-collections)
 3.  a. [The registration function](https://developer.wordpress.org/news/2024/04/01/how-to-register-custom-font-collections-for-the-font-library/#the-registration-function)
     b. [Font family definitions](https://developer.wordpress.org/news/2024/04/01/how-to-register-custom-font-collections-for-the-font-library/#font-family-definitions)
     c. [Registering a font collection via PHP](https://developer.wordpress.org/news/2024/04/01/how-to-register-custom-font-collections-for-the-font-library/#registering-a-font-collection-via-php)
     d. [Registering a font collection via JSON](https://developer.wordpress.org/news/2024/04/01/how-to-register-custom-font-collections-for-the-font-library/#registering-a-font-collection-via-json)
 4. [Unregistering font collections](https://developer.wordpress.org/news/2024/04/01/how-to-register-custom-font-collections-for-the-font-library/#unregistering-font-collections)
 5.  a. [Unregistering the Google Fonts collection](https://developer.wordpress.org/news/2024/04/01/how-to-register-custom-font-collections-for-the-font-library/#unregistering-the-google-fonts-collection)
 6. [Limitations for themes](https://developer.wordpress.org/news/2024/04/01/how-to-register-custom-font-collections-for-the-font-library/#limitations-for-themes)

## How font collections work

To find the Font Library in WordPress 6.5, you must go to **Appearance > Editor**
in the admin. Then, select the **Styles** panel (half circle icon). Within that 
panel, select **Typography** and you should see a new settings icon, which has a
tooltip of **Manage fonts**:

![WordPress Site Editor with the Styles panel open in the sidebar. The Typography
sub-panel is shown with settings fields for selecting fonts.](https://developer.
wordpress.org/news/files/2024/04/font-collection-typography-panel.webp)

It can feel a little hidden if you’re not familiar with navigating the interface
yet. But it’s located alongside all the other typography settings.

Once you click the **Manage fonts** button, a new **Fonts** modal will appear that
shows a few tabs, as in the screenshot below:

![Fonts modal overlaying the Site Editor screen in WordPress. The Google Fonts tab
is selected and shows a list of selectable fonts.](https://developer.wordpress.org/
news/files/2024/04/font-collection-google.webp)

The three tabs shown are:

 * **Library:** This will display all of the fonts from your theme and those installed
   via the Font Library.
 * **Upload:** Allows you to upload font files directly from your computer.
 * **Google Fonts:** This is the default font collection that ships with WordPress,
   letting you install any Google Font.

When you select a font from the **Google Fonts** collection, a new panel will appear
that lets you install variants of the font that you want for your website:

![Fonts modal overlaying the Site Editor screen in WordPress. The Fira Code font
is shown with two variants selected to install.](https://developer.wordpress.org/
news/files/2024/04/font-collection-install-font.webp)

It’s important to note that these fonts are stored locally in the user’s `/wp-content/
uploads/fonts` folder. This process works the same with the default collection and
any custom collections that you register in your theme.

## Registering font collections

There are two methods for registering fonts. The first method uses only PHP to define
the collection and its font families. The second method uses PHP to register the
collection but JSON to define the font families. We’ll walk through both of these
methods in this tutorial.

For this tutorial, I will focus on registering custom collections via a theme. But
you can certainly register collections from plugins—you’ll just need to change any
file paths to point to your plugin folder.

### The registration function

WordPress provides a helper function for registering font collections named `wp_register_font_collection()`.
Take a look at its signature:

    ```php
    wp_register_font_collection( string $slug, array $args );
    ```

The function accepts two parameters:

 * **`$slug`:** A unique identifier for your collection, which should only contain
   alphanumeric characters, dashes, and underscores. It’s best practice to prefix
   this with your theme or plugin slug.
 * **`$args`:** An array of arguments for defining your font collection:
    - **`name`:** The human-readable label for the collection, which should be internationalized.
    - **`description`:** An internationalized description for the collection, which
      is shown in the UI.
    - **`font_families`:** An array of font family definitions or a string containing
      the file path or URL to a JSON file containing the collection (you’ll learn
      how to define the families below).
    - **`categories`:** An array of categories. Each category should be an array
      that contains:
       * **`name`:** An internationalized label for the category.
       * **`slug`:** A unique slug containing only alphanumeric characters, dashes,
         and underscores.

To register a font collection, you should do so on the [`init`](https://developer.wordpress.org/reference/hooks/init/)
hook. For the remainder of this tutorial, you will work from a single function named`
themeslug_font_collections()`, which is an action on this hook.

Go ahead and add this code to your theme’s `functions.php` file to set everything
up:

    ```php
    add_action( 'init', 'themeslug_font_collections' );

    function themeslug_font_collections() {
    	// Register or unregister font collections here.
    }
    ```

### Font family definitions

Before moving forward, it’s important to understand how to define a font family 
in WordPress. If you’re familiar with the [format for defining font families](https://developer.wordpress.org/themes/global-settings-and-styles/settings/typography/#custom-font-families)
in `theme.json`, this will feel similar.

The following is an example of an array of font families. The first is of a system
font, and the second is a web font:

    ```php
    $font_families = [
    	[
    		'font_family_settings' => [
    			'fontFamily' => 'system-ui, sans-serif',
    			'slug'       => 'system-ui',
    			'name'       => __( 'System UI', 'themeslug' ),
    		],
    		'categories' => [ 'sans-serif' ]
    	],
    	[
    		'font_family_settings' => [
    			'name'       => __( 'Roboto Flex', 'themeslug' ),
    			'slug'       => 'roboto-flex',
    			'fontFamily' => 'Roboto Flex, sans-serif',
    			'fontFace'   => [
    				[
    					'src'        => 'https://fonts.gstatic.com/s/robotoflex/v9/NaN4epOXO_NexZs0b5QrzlOHb8wCikXpYqmZsWI-__OGfttPZktqc2VdZ80KvCLZaPcSBZtOx2MifRuWR28sPJtUMbsFEK6cRrleUx9Xgbm3WLHa_F4Ep4Fm0PN19Ik5Dntczx0wZGzhPlL1YNMYKbv9_1IQXOw7AiUJVXpRJ6cXW4O8TNGoXjC79QRyaLshNDUf3e0O-gn5rrZCu20YNYG0EACUTNK-QKavMlxGJI8dxef0jQ.woff2',
    					'fontWeight' => '400',
    					'fontStyle'  => 'normal',
    					'fontFamily' => 'Roboto Flex',
    					'preview'    => 'https://s.w.org/images/fonts/17.7/previews/roboto-flex/roboto-flex-400-normal.svg'
    				]
    			]
    		],
    		'categories' => [ 'sans-serif' ]
    	]
    ];
    ```

A font family definition consists of the following arguments:

 * **`font_family_settings`:** An array of settings for defining the font family,
   which adheres to the standard `theme.json` [format for defining font families](https://developer.wordpress.org/themes/global-settings-and-styles/settings/typography/#custom-font-families):
    - **`name`:** The human-readable title for the font family.
    - **`slug`:** A unique slug for the family, which should contain only alphanumeric
      characters, dashes, and underscores.
    - **`fontFamily`:** A valid value that will map to the CSS `font-family` value.
      Generally, this will be a font stack of families with fallbacks.
    - **`fontFace`:**_(Optional)_ An array of font faces that are mapped to the `@
      font-face` CSS at-rule. This is necessary to include web fonts from a URL.
      The format of the individual faces (variants) should be:
       * **`fontFamily`:** A valid CSS `font-family` descriptor.
       * **`fontWeight`:** A valid CSS `font-weight` value.
       * **`fontStyle`:** A valid CSS `font-style` value.
       * **`fontStretch`:** A valid CSS `font-stretch` value.
       * **`src`:** A file URL pointing to the font file.
       * **`preview`:** _(Optional)_ A file URL that points to an image for previewing
         the specific font face. If not defined, the `src` asset is loaded in the
         browser to render the preview.
    - **`preview`:** _(Optional)_ A file URL that points to an image for previewing
      the font family. If not defined, the `src` asset closest to the normal 400
      font face is loaded in the browser to render the preview.
 * **`categories`:** An array of category slugs (registered for the collection) 
   for the font family.

When registering a web font and a `preview` image is neither provided under `font_family_settings`
nor `fontFace`, WordPress will automatically load the font via the `fontFace.src`
file. This could have a performance impact with large collections, so it’s recommended
to include a preview image for web fonts.

At this point, you’ve learned the foundational parts that make up both a collection
and the font families within that collection. It can be a lot of information to 
consume at once. So let’s look at a real-world example and put what we’ve learned
into practice.

### Registering a font collection via PHP

The most straightforward way of registering a font collection is via PHP. You can
do everything from within one file, and this is ideal if you just have a few fonts
for your collection. If you have many fonts, you might want to use the JSON method
described in the next section.

One of my favorite typography-related sites is [Modern Font Stacks](https://modernfontstacks.com/),
which has a well-rounded list of system fonts. I thought it’d be a great idea to
take some of the font stacks from that site and bring them to the WordPress Font
Library. This also makes for an easier first example because system fonts don’t 
require font files.

Inside the `themeslug_fonts_collection()` function that you added to `functions.
php` earlier, paste this code:

    ```php
    wp_register_font_collection( 'modern-stacks', [
    	'name'          => __( 'Modern Stacks', 'themeslug' ),
    	'description'   => __( 'A collection of modern system fonts.', 'themeslug' ),
    	'font_families' => [
    		[
    			'font_family_settings' => [
    				'fontFamily' => 'system-ui, sans-serif',
    				'slug'       => 'system-ui',
    				'name'       => __( 'System UI', 'themeslug' ),
    			],
    			'categories' => [ 'sans-serif' ]
    		],
    		[
    			'font_family_settings' => [
    				'fontFamily' => "Charter, 'Bitstream Charter', 'Sitka Text', Cambria, serif",
    				'slug'       => 'transitional',
    				'name'       => __( 'Transitional', 'themeslug' ),
    			],
    			'categories' => [ 'serif' ]
    		],
    		[
    			'font_family_settings' => [
    				'fontFamily' => "'Nimbus Mono PS', 'Courier New', monospace",
    				'slug'       => 'monospace-slab-serif',
    				'name'       => __( 'Monospace Slab Serif', 'themeslug' ),
    			],
    			'categories' => [ 'monospace', 'serif' ]
    		],
    		[
    			'font_family_settings' => [
    				'fontFamily' => "'Segoe Print', 'Bradley Hand', Chilanka, TSCu_Comic, casual, cursive",
    				'slug'       => 'handwritten',
    				'name'       => __( 'Handwritten', 'themeslug' ),
    			],
    			'categories' => [ 'handwriting' ]
    		]
    	],
    	'categories' => [
    		[
    			'name' => __( 'Handwriting', 'themeslug' ),
    			'slug' => 'handwriting'
    		],
    		[
    			'name' => __( 'Monospace', 'themeslug' ),
    			'slug' => 'monospace'
    		],
    		[
    			'name' => __( 'Sans Serif', 'themeslug' ),
    			'slug' => 'sans-serif'
    		],
    		[
    			'name' => __( 'Serif', 'themeslug' ),
    			'slug' => 'serif'
    		]
    	]
    ] );
    ```

Once you save your file and refresh your browser, you should see the **Modern Stacks**
tab when reopening the **Fonts** modal:

![Fonts modal overlaying the Site Editor screen in WordPress. The Modern Stacks 
tab is selected and shows a list of modern system fonts.](https://developer.wordpress.
org/news/files/2024/04/font-collection-register-modern-stacks.webp)

At this point, if you want to test installing one of these fonts, just follow the
same procedure as earlier.

Because System fonts don’t have font files associated with them, there are no files
to install in the `/wp-content/uploads/fonts` directory.

### Registering a font collection via JSON

It may become a little unwieldy to manage font families from PHP as you add more
to your collection. JSON is usually a preferred format for storing these larger 
collections of data, and WordPress supports adding the font families for your collection
out of the box.

Let’s mix it up a bit and add a new collection of fantasy web fonts. Unlike the 
system fonts from the previous section, these will have physical files that will
be installed.

First, add this code inside your `themeslug_font_collections()` function that you’ve
already created in `functions.php`:

    ```php
    wp_register_font_collection( 'fantasy', [
    	'name'          => __( 'Fantasy', 'themeslug' ),
    	'description'   => __( 'A collection of fantasy fonts.', 'themeslug' ),
    	'font_families' => get_theme_file_path( 'assets/fonts/fantasy.json' ),
    	'categories' => [
    		[
    			'name' => __( 'Display', 'themeslug' ),
    			'slug' => 'display'
    		]
    	]
    ] );
    ```

Take note that the `font_families` argument is very different from the PHP example
in the previous section. Instead of passing an array of font family definitions,
you are passing a file path to a JSON file.

Now add a new `/assets/fonts/fantasy.json` file in your theme. You will use this
to register the font families in your collection.

For your JSON file, there are two top-level properties that you can set:

 * **`$schema`:**  A reference to the WordPress [font collection JSON schema](https://schemas.wp.org/trunk/font-collection.json),
   which can add hints in most modern code editors.
 * **`font_families`:** An array of font family definitions. The difference from
   the PHP method is that you must now use JSON formatting.

For this exercise, I am referencing URLs from Google Fonts and WordPress.org for
the `src` and `preview` arguments. You can see a full example via the WordPress 
[`font-collection.json`](https://s.w.org/images/fonts/17.7/collections/google-fonts-with-preview.json)
file. You may also choose to use custom URLs where these resources are hosted, such
as GitHub. 

Now add the following code to your `fantasy.json` file:

    ```language-json
    {
    	"$schema": "https://schemas.wp.org/trunk/font-collection.json",
    	"font_families": [
    		{
    			"font_family_settings": {
    				"name": "Henny Penny",
    				"fontFamily": "Henny Penny, system-ui",
    				"slug": "henny-penny",
    				"fontFace": [
    					{
    						"src": "https://fonts.gstatic.com/s/hennypenny/v17/wXKvE3UZookzsxz_kjGSfMQvt3M7tMDT.woff2",
    						"fontWeight": "400",
    						"fontStyle": "normal",
    						"fontFamily": "Henny Penny",
    						"preview": "https://s.w.org/images/fonts/17.7/previews/henny-penny/henny-penny-400-normal.svg"
    					}
    				],
    				"preview": "https://s.w.org/images/fonts/17.7/previews/henny-penny/henny-penny.svg"
    			},
    			"categories": [ "display" ]
    		},
    		{
    			"font_family_settings": {
    				"name": "MedievalSharp",
    				"fontFamily": "MedievalSharp, system-ui",
    				"slug": "medievalsharp",
    				"fontFace": [
    					{
    						"src": "https://fonts.gstatic.com/s/medievalsharp/v26/EvOJzAlL3oU5AQl2mP5KdgptAqp6MwvXLDk.woff2",
    						"fontWeight": "400",
    						"fontStyle": "normal",
    						"fontFamily": "MedievalSharp",
    						"preview": "https://s.w.org/images/fonts/17.7/previews/medievalsharp/medievalsharp-400-normal.svg"
    					}
    				],
    				"preview": "https://s.w.org/images/fonts/17.7/previews/medievalsharp/medievalsharp.svg"
    			},
    			"categories": [ "display" ]
    		},
    		{
    			"font_family_settings": {
    				"name": "Metamorphous",
    				"fontFamily": "Metamorphous, system-ui",
    				"slug": "metamorphous",
    				"fontFace": [
    					{
    						"src": "https://fonts.gstatic.com/s/metamorphous/v20/Wnz8HA03aAXcC39ZEX5y1330OSCthTsmaQ.woff2",
    						"fontWeight": "400",
    						"fontStyle": "normal",
    						"fontFamily": "Metamorphous",
    						"preview": "https://s.w.org/images/fonts/17.7/previews/metamorphous/metamorphous-400-normal.svg"
    					}
    				],
    				"preview": "https://s.w.org/images/fonts/17.7/previews/metamorphous/metamorphous.svg"
    			},
    			"categories": [ "display" ]
    		}
    	]
    }
    ```

Once you’ve saved the file and refreshed your browser window, you should see a new**
Fantasy** tab with your registered fonts in the **Fonts** modal:

![Fonts modal overlaying the Site Editor screen in WordPress. The Fantasy tab is
selected and shows various fantasy fonts.](https://developer.wordpress.org/news/
files/2024/04/font-collection-fantasy.webp)

As before, these can be installed and used just like any other fonts.

The downside of registering font families for the collection via JSON is that there
is no way to reference a dynamic URL, such as a theme folder, for the font file 
source and preview images. And hosting these assets via a third-party site could
run [afoul of the Theme Review guidelines](https://make.wordpress.org/themes/handbook/review/required/#9-files)(
only the Google Fonts CDN is allowed). In some cases, you may have no choice but
to use the PHP method.

## Unregistering font collections

To unregister a font collection, you must use the `wp_unregister_font_collection()`
function, which accepts a single `$slug` parameter from a previously registered 
font collection:

    ```php
    wp_unregister_font_collection( string $slug );
    ```

You can use this function to unregister collections that have been registered by
third-party plugins, a parent theme (if you’re building a child theme), or even 
WordPress. So let’s dive into a real-world example of how it works.

### Unregistering the Google Fonts collection

If you’ve been around theming as long as I have, you probably know by now that opening
the entire Google Fonts library to end-users is a recipe for breaking your theme’s
carefully crafted typography. **Not all fonts are made the same.**

If you want a more curated experience, I recommend disabling the default Google 
Fonts collection, offering only the fonts that you know work well enough with your
theme.

To unregister the Google Fonts collection, add this code inside your `themeslug_font_collections()`
function in `functions.php`:

    ```php
    wp_unregister_font_collection( 'google-fonts' );
    ```

When you open the **Fonts** modal, you should only see the **Modern Stacks** and**
Fantasy** collections that you registered earlier:

![Fonts modal overlaying the Site Editor screen in WordPress. The Library, Upload,
and custom collection tabs are shown, but the Google Fonts tab has been removed.](
https://developer.wordpress.org/news/files/2024/04/font-collection-unregister-google.
webp)

## Limitations for themes

The biggest limitation of custom font collections (and the Font Library feature 
overall) is that there is no way to map uploaded fonts to semantically named font
definitions in your `theme.json` file. This is the [recommended practice](https://developer.wordpress.org/themes/global-settings-and-styles/settings/typography/#custom-font-families)
defined in the Theme Handbook and the naming convention that the default Twenty 
Twenty-Four theme uses.

On a practical level, this means that users must define how each uploaded font is
used under the **Styles** panel in the Site Editor. With semantic names and a method
for mapping the uploading fonts, they would be automatically applied to the design,
but this is not currently supported.

For theme builders who enable the Font Library or define custom font collections,
make sure to note in your user documentation how installed fonts are applied.

Even with this limitation, font collections are really cool and open a lot of flexibility
for users who want to control their typography.

_Props to [@bph](https://profiles.wordpress.org/bph/) and [@ndiego](https://profiles.wordpress.org/ndiego/)
for feedback and review._

**Share the post: **

**Categories:** [Plugins](https://developer.wordpress.org/news/category/plugins/),
[Themes](https://developer.wordpress.org/news/category/themes/)

**Tags:** [Font Library](https://developer.wordpress.org/news/tag/font-library/)

## 4 responses to “How to register custom font collections for the Font Library”

 1.  ![Vasily Avatar](https://secure.gravatar.com/avatar/7da9b60438e541b0c68920ae802050ee115b45c5245fd3650a1a42f7f0159aea?
     s=40&d=identicon&r=g)
 2.  Vasily
 3.  [April 1, 2024](https://developer.wordpress.org/news/2024/04/how-to-register-custom-font-collections-for-the-font-library/#comment-4213)
 4.  Font library is a great feature, although the UX will be much nicer, if the Elements
     box indicator will show the actual font names instead of just Aa. It was suggested
     in Github a month ago. Here is the direct link: [https://github.com/WordPress/gutenberg/issues/59345](https://github.com/WordPress/gutenberg/issues/59345)
 5.  [Reply](https://developer.wordpress.org/news/2024/04/how-to-register-custom-font-collections-for-the-font-library/?replytocom=4213#respond)
 6.  ![NICHOLAS AMOL GOMES Avatar](https://secure.gravatar.com/avatar/e7b336c3bc67482e11c17ea3fbef2779bbcef365828685b7ea7acd4816d55e0a?
     s=40&d=identicon&r=g)
 7.  NICHOLAS AMOL GOMES
 8.  [April 2, 2024](https://developer.wordpress.org/news/2024/04/how-to-register-custom-font-collections-for-the-font-library/#comment-4219)
 9.  Thank you for your article work
 10. [Reply](https://developer.wordpress.org/news/2024/04/how-to-register-custom-font-collections-for-the-font-library/?replytocom=4219#respond)
 11. ![Christopher Avatar](https://secure.gravatar.com/avatar/71c43db0ef4857a16b6d8c306fd35889090ca01e14f52617ea613bf3a1a9eda1?
     s=40&d=identicon&r=g)
 12. Christopher
 13. [April 15, 2024](https://developer.wordpress.org/news/2024/04/how-to-register-custom-font-collections-for-the-font-library/#comment-5167)
 14. Any example of how to programmatically install (not register) a font?
 15. [Reply](https://developer.wordpress.org/news/2024/04/how-to-register-custom-font-collections-for-the-font-library/?replytocom=5167#respond)
 16.  a. ![Justin Tadlock Avatar](https://secure.gravatar.com/avatar/8013a62d7397c006bae48b96d6832a573ea71a7d5d3597fe584210567b508c05?
         s=40&d=identicon&r=g)
      b. [Justin Tadlock](https://profiles.wordpress.org/greenshady/)
      c. [April 15, 2024](https://developer.wordpress.org/news/2024/04/how-to-register-custom-font-collections-for-the-font-library/#comment-5169)
      d. I don’t know if there’s an API for that. I would just use the `theme.json` method
         for [adding custom font families](https://developer.wordpress.org/themes/global-settings-and-styles/settings/typography/#custom-font-families)
         in that case anyway. It would essentially be the same. It would be automatically
         loaded, and the user could still manage it.
      e. [Reply](https://developer.wordpress.org/news/2024/04/how-to-register-custom-font-collections-for-the-font-library/?replytocom=5169#respond)

### Leave a Reply 󠀁[Cancel reply](https://developer.wordpress.org/news/2024/04/how-to-register-custom-font-collections-for-the-font-library/?output_format=md#respond)󠁿

Your email address will not be published. Required fields are marked *

Comment *

Name *

Email *

Website

 Save my name, email, and website in this browser for the next time I comment.

 Notify me of follow-up comments by email.

 Notify me of new posts by email.

Δ

## Have an idea for a new post?

### 󠀁[Learn how to contribute](https://developer.wordpress.org/news/how-to-contribute/)󠁿

Share your knowledge with fellow WordPress developers.

Search

### 󠀁[Review tips and guidelines](https://developer.wordpress.org/news/tips-and-guidelines-for-writers/)󠁿

Everything you need to know about writing for the Blog.

## Subscribe to the Blog

  Email Address

 Join 1,771 other subscribers

 * [About](https://wordpress.org/about/)
 * [News](https://wordpress.org/news/)
 * [Hosting](https://wordpress.org/hosting/)
 * [Privacy](https://wordpress.org/about/privacy/)

 * [Showcase](https://wordpress.org/showcase/)
 * [Themes](https://wordpress.org/themes/)
 * [Plugins](https://wordpress.org/plugins/)
 * [Patterns](https://wordpress.org/patterns/)

 * [Learn](https://learn.wordpress.org/)
 * [Documentation](https://wordpress.org/documentation/)
 * [Developers](https://developer.wordpress.org/)
 * [WordPress.tv ](https://wordpress.tv/)

 * [Get Involved](https://make.wordpress.org/)
 * [Events](https://events.wordpress.org/)
 * [Donate ](https://wordpressfoundation.org/donate/)
 * [Swag ](https://mercantile.wordpress.org/)

 * [WordPress.com ](https://wordpress.com/?ref=wporg-footer)
 * [Matt ](https://ma.tt/)
 * [bbPress ](https://bbpress.org/)
 * [BuddyPress ](https://buddypress.org/)

 * [Visit our X (formerly Twitter) account](https://www.x.com/WordPress)
 * [Visit our Bluesky account](https://bsky.app/profile/wordpress.org)
 * [Visit our Mastodon account](https://mastodon.world/@WordPress)
 * [Visit our Threads account](https://www.threads.net/@wordpress)
 * [Visit our Facebook page](https://www.facebook.com/WordPress/)
 * [Visit our Instagram account](https://www.instagram.com/wordpress/)
 * [Visit our LinkedIn account](https://www.linkedin.com/company/wordpress)
 * [Visit our TikTok account](https://www.tiktok.com/@wordpress)
 * [Visit our YouTube channel](https://www.youtube.com/wordpress)
 * [Visit our Tumblr account](https://wordpress.tumblr.com/)

![Code is Poetry](https://s.w.org/style/images/code-is-poetry-for-dark-bg.svg)

 The WordPress® trademark is the intellectual property of the WordPress Foundation.