Some images that are uploaded to WordPress don't show up in the Media Library. The images get uploaded and even cropped to the defined sizes, there is an entry in the Media Library, but the preview image doesn't show. I can even use them as a featured image and they show up correctly on my website.
I was able to find the cause of the problem: If there are special characters (like German umlauts) in the IPTC "Keywords" field in the JPGs, then this problem occurs. As soon as I use Exiftool to remove the "Keywords" field from a JPG that shows the mentioned problems, this file works without any problems. I could verify this problem on three WordPress installations on two completely different web servers hosted by different companies. The Wordpress version is
I'm inclined to report this as a WordPress bug. But before doing so, I want to nail down the real problem any further. I could find that for all "bad" images, there's no
_wp_attachment_metadata entry in the
If I hack the
wp-admin/includes/image.php file and set
$meta['keywords'] = array(); in
wp_read_image_metadata(), everything works fine. Obviously there is somewhere some code that uses the result from
wp_read_image_metadata() to create a
_wp_attachment_metadata row for that attachment. But where is that code that fails to insert
_wp_attachment_metadata if there's a problem with wrongly encoded strings in
And is there a hook to override that problem in my installations? One WordPress installation that shows that problem is used by several editors who are extremely computer unsavvy. Telling them to use a software on their PC to remove the faulty IPTC tags is a no-go. But I also don't want to hack the mentioned core file on a live system.
Update: Here are two identical images where one shows the problem, the other does not. The only difference is in the field "keywords", where one has the content "sweet", the other one "süß" (= German word for sweet).