Make WordPress Core


Ignore:
Timestamp:
06/05/2024 11:17:18 PM (10 months 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/fonts.php

    r58073 r58353  
    231231
    232232    $font_files = get_post_meta( $post_id, '_wp_font_face_file', false );
    233     $font_dir   = wp_get_font_dir()['path'];
     233    $font_dir   = untrailingslashit( wp_get_font_dir()['basedir'] );
    234234
    235235    foreach ( $font_files as $font_file ) {
Note: See TracChangeset for help on using the changeset viewer.