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

Pass title attribute when uploading an image #8955

merged 1 commit into from Aug 21, 2018


None yet
3 participants

WPprodigy commented Aug 14, 2018


Fixes #8902 by passing along an image title during the upload.

How has this been tested?

Steps to test:

  1. Upload a new image to the GB image block called image name.png.
  2. Notice the title is now image-name.
  3. Apply patch and upload a new image called another image.png.
  4. Notice the title is now correctly another image.



Types of changes

The title will be the file's name (ex file name.jpg) if it exists, except with the extension and period removed. If the file name does not exist (an edge case shown in the line above), then it will pass image/png for example, except a period substituted for the slash as done on line 161.

The regex for removing the extension is the same used in WP core and


  • My code is tested.
  • My code follows the WordPress code style.
  • My code follows the accessibility standards.
  • My code has proper inline documentation.

This PR seems to work correctly in my tests. The title now matches the one used when uploading the file using the media library. I think this can be merged after the release.
Thank you for your contributions @WPprodigy!

@danielbachhuber danielbachhuber added this to the 3.7 milestone Aug 17, 2018

@jorgefilipecosta jorgefilipecosta merged commit e2f3120 into WordPress:master Aug 21, 2018

2 checks passed

codecov/project 50.59% (-0.01%) compared to acef68f
continuous-integration/travis-ci/pr The Travis CI build passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment