Make WordPress Core

Opened 6 years ago

Last modified 18 months ago

#43227 new enhancement

Media uploaded to post should remove underscores and hyphens from text inserted into title attribute

Reported by: mrmadhat's profile mrmadhat Owned by:
Milestone: Future Release Priority: normal
Severity: normal Version:
Component: Media Keywords: needs-patch
Focuses: Cc:


When adding a new image into a post my file name will typically be called something like:


Once this image is uploaded wp will automatically set the title and will default to the name of the image "descriptive-name-of-image" if no title meta data is available in the image.

I think a better default action would be to replace the hyphens/underscores with spaces and possibly capitalising the first letter making the title "Descriptive name of image".

Change History (2)

#1 @joemcgill
5 years ago

  • Keywords needs-patch added
  • Milestone changed from Awaiting Review to Future Release

Hi @mrmadhat, thanks for the suggestion. I'm surprised nobody has suggested this already, but I don't see a previous ticket.

#2 @abitofmind
18 months ago

When someone looks into the topic of "filename to image metadata fields in the Media Library" this is closely related:
Inserting media via Gutenberg creates kebab case in media title vs. Upload New Media preserves whitespace

  • In that case the filename has spaces on upload. (In your example the filename starts its lifecycle with underscores and hyphens)
  • The media title then sadly gets "-" minus instead of " " space characters. (Kebab case)
    • So I guess instead of writing the original filename without the extension into the media title, the filename sanitazion happens first, and then the transfer to the media title happens.
    • A pity that such a minor bug takes that long to getting fixed. (I myself am no developer, but a UX designer)
Note: See TracTickets for help on using tickets.