Opened 9 years ago
Last modified 4 years ago
#43227 new enhancement
Media uploaded to post should remove underscores and hyphens from text inserted into title attribute
| Reported by: | mrmadhat | Owned by: | |
|---|---|---|---|
| Priority: | normal | Milestone: | Future Release |
| Component: | Media | Version: | |
| Severity: | normal | Keywords: | needs-patch |
| Cc: | Focuses: |
Description
When adding a new image into a post my file name will typically be called something like:
descriptive-name-of-image.jpg
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)
#2
@
4 years 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)
![(please configure the [header_logo] section in trac.ini)](/chrome/site/your_project_logo.png)
Hi @mrmadhat, thanks for the suggestion. I'm surprised nobody has suggested this already, but I don't see a previous ticket.