WordPress.org

Make WordPress Core

Opened 11 months ago

Closed 11 months ago

Last modified 11 months ago

#51841 closed feature request (worksforme)

Please add a wordpress function to convert a given file name string into what it would turn into if uploaded to the media library

Reported by: tannerm Owned by:
Milestone: Priority: normal
Severity: normal Version:
Component: Media Keywords:
Focuses: Cc:

Description

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.

Change History (4)

#1 @tannerm
11 months ago

  • Resolution set to worksforme
  • Status changed from new to closed

#3 @davidbaumwald
11 months ago

  • Component changed from General to Filesystem API
  • Milestone Awaiting Review deleted

#4 @SergeyBiryukov
11 months ago

  • Component changed from Filesystem API to Media
Note: See TracTickets for help on using tickets.