Skip to content
Prev Previous commit
Next Next commit
Use variable for font_dir so function isn't called repeatedly within …
…loop
  • Loading branch information
creativecoder committed Feb 5, 2024
commit 62487785d063292c9f76ed726687ade8684afc0b
3 changes: 2 additions & 1 deletion lib/compat/wordpress-6.5/fonts/fonts.php
Original file line number Diff line number Diff line change
Expand Up @@ -257,9 +257,10 @@ function _wp_before_delete_font_face( $post_id, $post ) {
}

$font_files = get_post_meta( $post_id, '_wp_font_face_file', false );
$font_dir = wp_get_font_dir()['path'];

foreach ( $font_files as $font_file ) {
wp_delete_file( wp_get_font_dir()['path'] . '/' . $font_file );
wp_delete_file( $font_dir . '/' . $font_file );
}
}
add_action( 'before_delete_post', '_wp_before_delete_font_face', 10, 2 );
Expand Down