[wp-trac] [WordPress Trac] #61297: Font Directory uploads ignore `subdir` property.

WordPress Trac noreply at wordpress.org
Sun May 26 23:48:06 UTC 2024


#61297: Font Directory uploads ignore `subdir` property.
---------------------------+-----------------------------
 Reporter:  peterwilsoncc  |      Owner:  (none)
     Type:  defect (bug)   |     Status:  new
 Priority:  normal         |  Milestone:  Awaiting Review
Component:  Editor         |    Version:
 Severity:  normal         |   Keywords:
  Focuses:                 |
---------------------------+-----------------------------
 The data structure for the font directory matches the uploads directory
 and contains the following properties:

 * path
 * url
 * subdir
 * basedir
 * baseurl
 * error (only used during directory creation)

 When uploading fonts, the sub-directory property is ignored and prevents
 the use of sub-directories by developers.

 This prevents developers from being able to organize the font files by
 font-family or the active theme at time of upload.

 {{{#!php
 add_filter( 'font_dir', function ( $font_dir ) {
         /*
          * Change sub-directory every 5 minutes.
          *
          * POC only, a more likely use is to get the `fontFamily` from the
 API
          * request or the currently active theme and use either of those
 values
          * to generate a unique sub-directory.
          *
          * The POC is simply to allow for eaiser testing by setting a new
          * sub-directory every few minutes.
          */
         $font_dir['subdir'] = floor( time() / 300 );
         return $font_dir;
 } );
 }}}

 The following will need to be updated to account for the sub-directory:

 * upload destination
 * post meta data containing the file reference
 * deletion of files in `_wp_before_delete_font_face()`

-- 
Ticket URL: <https://core.trac.wordpress.org/ticket/61297>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list