Skip to content

Commit

Permalink
use the same format as in the wp-content/fonts default path
Browse files Browse the repository at this point in the history
  • Loading branch information
matiasbenedetto committed Mar 12, 2024
1 parent 8e23ae4 commit 25d3c80
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 7 deletions.
10 changes: 6 additions & 4 deletions src/wp-includes/fonts.php
Original file line number Diff line number Diff line change
Expand Up @@ -123,10 +123,12 @@ function wp_default_font_dir( $refresh_cache = false ) {
wp_mkdir_p( $defaults['path'] );

if ( ! wp_is_writable( $defaults['path'] ) ) {
$defaults = wp_upload_dir();
$defaults['path'] = path_join( $defaults['basedir'], 'fonts' );
$defaults['url'] = $defaults['baseurl'] . '/fonts';
$defaults['subdir'] = '/fonts';
$defaults = wp_upload_dir();
$defaults['path'] = path_join( $defaults['basedir'], 'fonts' );
$defaults['url'] = $defaults['baseurl'] . '/fonts';
$defaults['subdir'] = '';
$defaults['basedir'] = path_join( $defaults['basedir'], 'fonts' );
$defaults['baseurl'] = $defaults['baseurl'] . '/fonts';
}

update_option( 'font_dir', $defaults );
Expand Down
6 changes: 3 additions & 3 deletions tests/phpunit/tests/fonts/wpDefaultFontDir.php
Original file line number Diff line number Diff line change
Expand Up @@ -39,9 +39,9 @@ public function test_uploads_font_dir() {
array(
'path' => path_join( $upload_dir['basedir'], 'fonts' ),
'url' => $upload_dir['baseurl'] . '/fonts',
'subdir' => '/fonts',
'basedir' => $upload_dir['basedir'],
'baseurl' => $upload_dir['baseurl'],
'subdir' => '',
'basedir' => path_join( $upload_dir['basedir'], 'fonts' ),
'baseurl' => $upload_dir['baseurl'] . '/fonts',
'error' => false,
),
$font_dir,
Expand Down

0 comments on commit 25d3c80

Please sign in to comment.