-
Notifications
You must be signed in to change notification settings - Fork 4.6k
Closed
Labels
[Feature] Font Library[Feature] TypographyFont and typography-related issues and PRsFont and typography-related issues and PRs[Priority] HighUsed to indicate top priority items that need quick attentionUsed to indicate top priority items that need quick attention[Status] In ProgressTracking issues with work in progressTracking issues with work in progress[Type] BugAn existing feature does not function as intendedAn existing feature does not function as intended
Description
Description
When testing a filter to change the directory of downloaded fonts, the fonts are not installed and return an error instead. Using the example in #57697 as a base.
Example code:
/**
* Define a custom font directory for the WP Font Library.
*/
function alter_wp_fonts_dir( $defaults ) {
$wp_upload_dir = wp_get_upload_dir();
$uploads_basedir = $wp_upload_dir['basedir'];
$uploads_baseurl = $wp_upload_dir['baseurl'];
$fonts_dir = $uploads_basedir . '/fonts';
// Generate the URL for the fonts directory from the font dir.
$fonts_url = str_replace( $uploads_basedir, $uploads_baseurl, $fonts_dir );
$defaults['path'] = $fonts_dir;
$defaults['url'] = $fonts_url;
return $defaults;
}
add_filter( 'font_dir', 'alter_wp_fonts_dir' );
Step-by-step reproduction instructions
- Hook the code above to a function bootstrapped on
init
. - Navigate to the Font Library
- Navigate to Install Fonts
- Pick a font to install
- Click the Install button
Screenshots, screen recording, code snippet
Environment info
- WordPress 6.5-alpha-57531
- PHP: tested on 7.4.33, 8.1.18, 8.2.5
- Gutenberg: tested on 17.6.1, 17.6.2, 17.6.4
- MacOS Sonoma 14.2.1
- Google Chrome 121.0.6167.85
Please confirm that you have searched existing issues in the repo.
Yes
Please confirm that you have tested with all plugins deactivated except Gutenberg.
Yes
Metadata
Metadata
Assignees
Labels
[Feature] Font Library[Feature] TypographyFont and typography-related issues and PRsFont and typography-related issues and PRs[Priority] HighUsed to indicate top priority items that need quick attentionUsed to indicate top priority items that need quick attention[Status] In ProgressTracking issues with work in progressTracking issues with work in progress[Type] BugAn existing feature does not function as intendedAn existing feature does not function as intended