-
Notifications
You must be signed in to change notification settings - Fork 4.7k
Description
Enhancement Scope:
To add automatic detection and enqueueing of all user-selected global fonts before printing the fonts (likely within wp_print_fonts()).
What are "user-selected global fonts"?
Fonts that a user selected and saved from the Site Editor > Styles > Typography UI.

They are "global" because a selection in this UI is intended for global availability throughout the website and content.
How are these fonts made available for user selection?
Fonts defined within a theme's theme.json file are already automatically registered and enqueued within the Fonts API.
For plugins and theme's without a theme.json file, the API does not provide the mechanism to detect or enqueue their fonts when a user selects them.
What problem does this address?
🔹 Plugins and theme's without a theme.json file have been required to provide the detection and enqueuing of their user-selected fonts. This enhancement moves that mechanism and functionality into the Fonts API so that detection and enqueuing are within the API.
Why are the benefits?
- Easier for extenders: extenders will no longer need to provide or maintain this functionality in their products.
- Makes the out-of-box enqueuing process more consistent, stable, and predictable.
What is your proposed solution?
Before printing the fonts (likely within the wp_fonts_print(), i.e. as late as possible:
- Fetch all of the user-selected global fonts (those fonts that the user picked and saved from the Site Editor > Styles > Typography). Font: Need the font-family handles.
- Enqueue those font families.