So I’ve got a bunch of content with images inserted into them. The users inserting content have done the default option of linking to the attachment page which isn’t great. I’ve altered the
image_default_link_type
setting to make this link to the file by default now.
But I’d like to use a light box or something to display images on the site, which requires the to go to the image file, not the attachment page. Whilst I can make this work for images added since the default was changed, I was wondering if there was any solution that could make this change for me that was not going through and altering the content of each post?
TIA, Dan.
If you are never going to use the attachment page, then you can simply change the HTTP header ( a php function ) of attachment page to the image file.
Example –
Note – Call it inside WordPress loop.