[wp-trac] [WordPress Trac] #51841: Please add a wordpress function to convert a given file name string into what it would turn into if uploaded to the media library

WordPress Trac noreply at wordpress.org
Fri Nov 20 22:42:59 UTC 2020


#51841: Please add a wordpress function to convert a given file name string into
what it would turn into if uploaded to the media library
-----------------------------+-----------------------------
 Reporter:  tannerm          |      Owner:  (none)
     Type:  feature request  |     Status:  new
 Priority:  normal           |  Milestone:  Awaiting Review
Component:  General          |    Version:
 Severity:  normal           |   Keywords:
  Focuses:                   |
-----------------------------+-----------------------------
 When writing import scripts, it can be very difficult trying to set post
 thumbnails on posts if the client gives us files named things like:

 Ranked Choice Voting and Women_s Representation. Cambridge, MA
 THUMBNAIL.png

 I'd like to be able to take that string and put it into a wordpress
 function that converts it to the filename that wordpress creates when it
 is successfully added to the media library:

 Ranked-Choice-Voting-and-Women_s-Representation.-Cambridge-MA-
 THUMBNAIL.png

 If this function already exists somewhere I would greatly appreciate being
 directed to it.

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


More information about the wp-trac mailing list