I see that your images don’t use the regular path /wp-content/uploads/... but /media instead. In this case the plugin has no chance to get the captions from WordPress if you did not customize your WordPress installation so it will find image metadata using /media as well.
Technical background:
If the caption can not be found in the HTML code (figcaption, alt attribute in the image etc.) Lightbox with PhotoSwipe tries to get the meta data from WordPress based on the image name if the option “Get the caption from the database” is used.
However – this also means, the image name in the HTML code has to be identical to the one in the database. So if you have an image named /media/mond-13Feb11.jpg this exact path has to be in the WordPress database as well, otherwise captions can not be read, because WordPress will not find anything when asking for metadata for the URL /media/mond-13Feb11.jpg.
If you implemented some kind of rewriting (or use a plugin) to change all /wp-content/upload/... URLs to “nice” /media for the output, Lightbox with PhotoSwipe can not get the caption from the database any longer.
If this will help, I could add a filter function for the next version which gets the image name from the HTML code and can provide the real image path name in the database if needed.
In addition: a workaround is to put the captions to “Alternative text”, so they will be output as alt in the image.
Hi Arno,
thanks for the swift reply. Ages ago, when I first set up wordpress, I chose to change my default upload directory to /media… so it is really hard wired.
In the meanwhile I played around a bit with different new plugins that I recently installed. I think, that the “autooptimize” plugin might interfere with your plugin.. I’m not sure yet.
How did you change the uplaod directory? Did you overwrite the UPLOADS setting in wp-config.php? In this case I wonder why the meta data can not be retrieved. Maybe this is a bug in WordPress, but I have to spend more time to figure this out.
yes, I changed the media path in wp-config.
After tinkering around for a bit, I can still not deduce the logic behind those missing captions. even the “alt” texts are not displayed. the only caption that will show up is the figurecaption… so, i _could_ make a workaround by css display:none.. however, then I have to completely do without them on my pages.
Well, thanks for now… I will gladly keep you updated, as soon as I find out more 🙂
The “alt” texts are displayed, see these examples from your website:
https://doktor-schubert.net/medizin/brustkrebstherapie-und-demenz/
There is one image with the alt text “Breast Cancer Awareness” which is also used for the caption.
https://doktor-schubert.net/medizin/miracle-mineral-supplement-mms/
And here is an image which has “Pillen und Kapseln im Blister” as alt text which is also used. And there is also a description which got fetched from the database which also got used.
Hmm, okay. Strangely, I checked the two examples that you gave me and saw no caption. then I followed an inspiration and logged out of my site account.. and lo and behold.. suddenly the captions were there!!!!
So, i guess, there’s an incompatibility with some admin plugin or the admin taskbar.