Make WordPress Core


Ignore:
Timestamp:
06/05/2024 11:17:18 PM (2 years ago)
Author:
peterwilsoncc
Message:

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.

Props costdev, grantmkin, peterwilsoncc.
Fixes #61297.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/rest-api/endpoints/class-wp-rest-font-faces-controller.php

    r58328 r58353  
    917917
    918918        $fonts_dir = wp_get_font_dir();
    919         if ( str_starts_with( $new_path, $fonts_dir['path'] ) ) {
    920             $new_path = str_replace( $fonts_dir, '', $new_path );
     919        if ( str_starts_with( $new_path, $fonts_dir['basedir'] ) ) {
     920            $new_path = str_replace( $fonts_dir['basedir'], '', $new_path );
    921921            $new_path = ltrim( $new_path, '/' );
    922922        }
Note: See TracChangeset for help on using the changeset viewer.