-
Notifications
You must be signed in to change notification settings - Fork 4.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Hyphen automatically gets added on 'title' tag of image #8902
Comments
@anupviews do you happen to know if there was a Core Trac ticket about this issue? I was under the impression that WordPress always normalised image filenames, but perhaps I'm wrong :) |
Oh, do you mean in generating the "title" attribute of the image? A screenshot would be helpful here as well, if you have one! |
I uploaded an image (
When clicking on the pencil icon in the block for the image though, I do see the hyphenated title: So a GB uploaded image is auto-hyphenating the image title, but it does not use the title attribute, which has been brought up here: #7504 I then uploaded a new image through just the media library in WP. This time, the image title was not auto-hyphenated I believe the relevant trac ticket can be found here: https://core.trac.wordpress.org/ticket/37989 I've not done much digging, but this might be a core rest api issue rather than GB specific. |
Ah yea, so the title is getting assigned while the image is being uploaded via the rest api here: https://github.com/WordPress/WordPress/blob/aab929b8d619bde14495a97cdc1eb7bdf1f1d487/wp-includes/rest-api/endpoints/class-wp-rest-attachments-controller.php#L143 Possible Solutions:
|
@chrisvanpatten I uploaded an image (file name without hyphen), and the editor adds title tag as follows: It automatically adds hyphenated title. I reported this issue with previously, but I don't remember which version had it. And as @WPprodigy pointed out, it does not add title tag in frontend output even though I added something using the 'title' filed of the image: Edit: Found the trac ticket here: https://core.trac.wordpress.org/ticket/38090 |
Opened up a wp core issue as well, linking for reference: https://core.trac.wordpress.org/ticket/44789 |
I vaguely remember the issue, but fairly sure your SS is expected behavior. The image name had hyphens on it when uploaded, so they will also be there in the title by default. |
The Gutenberg editor is adding the hypens to the file name. When uploading images from a recipe plugin, for example, the issue does not occur. |
When I upload an image that has no hyphen (eg. round clock.jpg), it automatically adds hyphen in the title tag and appears as: round-clock. This had happened with previous version of WordPress and was fixed, but Gutenberg has this bug.
Please fix this.
The text was updated successfully, but these errors were encountered: