I have hundreds of images in my media library, most have which have no titles.
In the media library, the “(no title)” message is displayed along these images.
Since I generally have one image per post, I would like to auto-populate the library titles, by grabbing the associated post name. I don’t mind if I overwrite some existing titles.
Does anyone know of a hack that will do this?
I found some plugins, like ‘Media Rename’ and ‘Rename Media’ and ‘SEO friendly images’ but they are usually for renaming the actual image files, or for creating HTML title tags directly in the HTML (on the fly).
I want to create titles within the WordPress media library, so that I don’t see the (no title) message. This title data will also help me to search for images in the library — although, for anyone with the same issue, I did find a plugin called ‘Media Search’ that enables searching images by associated posts: http://wordpress.org/extend/plugins/media-library-search/
If you can do SQL manually then try:
If you need a PHP function then try:
WARNING: As this will make massive changes to your database I would do a backup first!
I did run a small test and it appears to be correct but USE AT YOUR OWN RISK!