Sort uploaded font files into subdirectories for each font family#60402
Sort uploaded font files into subdirectories for each font family#60402creativecoder wants to merge 3 commits intotrunkfrom
Conversation
|
This is still in draft because I'd like to add/update unit tests for the subdirectory uploads. |
54e9bec to
04396fb
Compare
|
This pull request has changed or added PHP files. Please confirm whether these changes need to be synced to WordPress Core, and therefore featured in the next release of WordPress. If so, it is recommended to create a new Trac ticket and submit a pull request to the WordPress Core Github repository soon after this pull request is merged. If you're unsure, you can always ask for help in the #core-editor channel in WordPress Slack. Thank you! ❤️ View changed files❔ lib/compat/wordpress-6.6/fonts/class-gutenberg-rest-font-faces-controller.php ❔ lib/compat/wordpress-6.6/fonts/fonts.php ❔ lib/load.php |
mikachan
left a comment
There was a problem hiding this comment.
This is working really well for me so far. I believe sorting the font files into subdirectories is a good improvement too, it's much easier to find files like this when the file names are non-descriptive, e.g. N0b52SlTPu5rIkWIZjVKKtYtfxYqZ4RJBFzFfYUjkSDdlqZgy7JYxnL31AHfAAy5.woff2.
Test report:
- Install a Google font to your site and see that the font file is stored in a subdirectory using the font family slug ✅
- Upload a font file to your site and see that the font file is stored in a subdirectory using the font family slug ✅
- Delete both font families and see that the files and the subdirectory are deleted ✅
The fonts were successfully stored in a subdirectory using the font family slug:

I can see you're planning to add tests later, happy to come back and give this a more detailed review then. The code is looking good to me - it's well organised and the comments are helpful, especially for the merge with Core.
| * | ||
| * @package WordPress | ||
| * @subpackage REST_API | ||
| * @since 6.5.0 |
There was a problem hiding this comment.
| * @since 6.5.0 | |
| * @since 6.6.0 |
I'm guessing this version number may need to be updated for 6.6?
What?
Sort font file uploads into subdirectories within the fonts folder, according to font family.
Related to #58411
Why?
How?
Adds additional filtering to the
Testing Instructions