I am looking for a way to replace all links on images.
Currently when a user clicks an image it links to the source file.
What I want it to do is to ink to: example.com/editor=12&image=filename.jpg
So every that encloses an should link to that site with the image filename so it can be loaded in an editor.
First, I tried to replace the links with ajax, but that does not work with lazy load and also seems less practical.
The second thing I tried is to filter the $content of the post. But with that I can only replace the /wp-content/uploads/ part.
I can’t filter for the first part (http://) which leads to also all src being replaced and no image shows up at all.
Is there any way to do this by hooks maybe?
Read more here:: Generate links on all images in posts – is there a hook?