Font Library update: storage of font files

This post has been superseded by the post WordPress 6.5 release delayed 1 week, in which it’s announced fonts will be uploaded to the fonts sub-directory of the uploads folder.

The Font Library, a new feature of WordPress 6.5, will allow users of blockBlock Block is the abstract term used to describe units of markup that, composed together, form the content or layout of a webpage using the WordPress editor. The idea combines concepts of what in the past may have achieved with shortcodes, custom HTML, and embed discovery into a single consistent API and user experience. editor themes to upload and customize their site’s fonts. You can learn about the full set of Font Library features in the #dev-note.

As fonts are a new first-class object, there has been some discussion around where to store the associated files while accounting for different file systems used by WordPress sites. The particular challenge has been for file systems that do not allow for the writing of files outside the uploads directory (See Gutenberg#59417 and Gutenberg#59699).

To account for such file systems, it was originally decided to natively fallback to the uploads directory natively in WordPress CoreCore Core is the set of software required to run WordPress. The Core Development Team builds WordPress..

Revised approach to font file storage

Exploratory work on supporting a fallback directory natively has demonstrated that this approach would lead to a high risk of bugs. Therefore, the original decision is being modified and the new approach will be:

  • WordPress Core will by default only attempt to store font files in the wp-content/fonts directory,
  • For file systems unable to write to or persistently store files in the new directory it is recommended to install the pluginPlugin A plugin is a piece of software containing a group of functions that can be added to a WordPress website. They can extend functionality or add new features to your WordPress websites. WordPress plugins are written in the PHP programming language and integrate seamlessly with WordPress. These can be free in the Plugin Directory or can be cost-based plugin from a third-party Fonts to Uploads to store the files in the under existing uploads directory, in wp-content/uploads/fonts
  • Developers wishing to modify the directory without using a plugin can use the font_dir filterFilter Filters are one of the two types of Hooks They provide a way for functions to modify data of other functions. They are the counterpart to Actions. Unlike Actions, filters are meant to work in an isolated manner, and should never have side effects such as affecting global variables and output. documented in the announcement post.

Props @mmaattiiaass and other contributors for working on the exploratory pull request.

Thank you @desrosj, @priethor, @chanthaboune and @jorbin for contributing to and reviewing this post.

#6-5, #dev-notes, #dev-notes-6-5