I’ve been breaking my head over this for a few days but I yet have to find a proper solution. I’m working on a WordPress site, where all images inside posts are linking to the corresponding attachment pages. I want to use a lightbox but obviously this would require changing all the links back to the media files directly (e.g. xyz.jpg).
The site has a significant number of posts and images so it would be impossible to do this manually.
Does anyone know of a plugin or other solution that would simply replace – in bulk – all of the image links to link to the media file, instead of the attachment page?
Here is one answer that, although jQuery-based, did the trick, and is much quicker than and safer than a PHP-script to go through the whole DB. The drawback is that it will link to the resized image url instead of the full image url. There’s probably a way to catch that with jQuery as well, but this was enough for my needs.