mercredi 25 mars 2015

Caption is not loading on a couple images only


I've got some strange behavior going on with WordPress Images.


I put up let’s say 20 images into a WordPress site on my development system through the media tab on the backend. Each one is attached as a featured image to a custom-post-type. Every image has a caption and every image was loaded the same way and populated with the captions in the same, consistent manner. But I noticed when viewing each post that at least three of the images were not displaying the caption while all others were.


I checked the images and confirmed the captions were there. I then carefully inspected and double checked the code line by line for any styling issues. There were none. However, on the images not displaying the captions, I found the captions themselves had not loaded into the HTML code at all. So that explains why they aren't showing. BUT I verified in the backend these images indeed had captions.


Then I started checking in different browsers. It was Chrome that the captions did not display on some of these images. I had Firefox open also and went to the same post in Firefox and the caption was showing for the exact same image that Chrome wasn't showing. Ah-Ha!, but it only made the mystery worse because the difference is I was logged into the WordPress backed in the Firefox page, but not in the Chrome page. So I logged out of the Firefox page and refreshed and BOOM. Captions disappeared in Firefox too.


I then started experimenting. I updated permalinks. I went in and removed the caption text, saved the image, re-entered the caption text and saved the image again. None of this made any difference.


On my PC I then made a copy of the image I had originally uploaded that was not showing captions, uploaded it to WordPress and added captions exactly as I had done before. Then I used the copy of the image as the featured image on the post where the caption wasn't showing and the caption now shows. I then switched the featured image back to the original one and the captions stopped showing again.


I then deleted the other two images from WordPress, uploaded the images again from my PC (the exact same images mind you, no copies) and replacing the images solved the issue across the board.


Obviously something happened with my first set of images I uploaded? If it were isolated, I'd let it go. But it happened with several images and now I am curious if anyone knows what causes this to happen? Just a corruption in the file when I upload it 3 times over 20 images?


What really throws me is how the captions loaded fine when logged into the backend, but not when I was not logged out.


I hate Gremlins in the machine. Anyone have any insight?





Aucun commentaire:

Enregistrer un commentaire