mirror of
https://github.com/WordPress/WordPress.git
synced 2025-02-21 05:55:18 +00:00
Editor (Font Library): Store font subdirectory in post meta.
Stores the font file sub-directory in the `wp_font_face` post meta. Similar to attachments, only the portion of the path relative to the base directory is stored. This ensures the files can be deleted alongside their post on sites using a plugin to store font files in sub-directories. Previously running such a plugin would result in the files remaining on the file system post delete. Reviewed by hellofromTonya. Merges [58353] to the 6.5 branch. Props costdev, grantmkin, peterwilsoncc. Fixes #61297. Built from https://develop.svn.wordpress.org/branches/6.5@58448 git-svn-id: http://core.svn.wordpress.org/branches/6.5@57897 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
2a8a9110d7
commit
04c37c5a04
@ -228,7 +228,7 @@ 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'];
|
||||
$font_dir = untrailingslashit( wp_get_font_dir()['basedir'] );
|
||||
|
||||
foreach ( $font_files as $font_file ) {
|
||||
wp_delete_file( $font_dir . '/' . $font_file );
|
||||
|
@ -916,8 +916,8 @@ class WP_REST_Font_Faces_Controller extends WP_REST_Posts_Controller {
|
||||
$new_path = $path;
|
||||
|
||||
$fonts_dir = wp_get_font_dir();
|
||||
if ( str_starts_with( $new_path, $fonts_dir['path'] ) ) {
|
||||
$new_path = str_replace( $fonts_dir, '', $new_path );
|
||||
if ( str_starts_with( $new_path, $fonts_dir['basedir'] ) ) {
|
||||
$new_path = str_replace( $fonts_dir['basedir'], '', $new_path );
|
||||
$new_path = ltrim( $new_path, '/' );
|
||||
}
|
||||
|
||||
|
@ -16,7 +16,7 @@
|
||||
*
|
||||
* @global string $wp_version
|
||||
*/
|
||||
$wp_version = '6.5.5-alpha-58445';
|
||||
$wp_version = '6.5.5-alpha-58448';
|
||||
|
||||
/**
|
||||
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.
|
||||
|
Loading…
x
Reference in New Issue
Block a user