WordPress gallery only links to image files? Help!

This was a cry for help that I got from a client a short while ago when they wanted to change their galleries to link from the image files to the attachment pages so they could get more content on the site, and offer a bit more functionality than displaying only a standard image could. While it seems to be a  very quick and easy fix, it turned out to be a little more complicated than it should have been.

As normal, I did what I thought would be right. I went into the posts editing page, looked at the gallery, and removed the link=”file” attribute in the shortcode, saved the page, and looked at my handiwork!

Oh… That didn’t work. The gallery still links to the image file, and not the attachment page. OK, so back into the editor, check, and no, nothing there saying to link to file.

I tested this with another gallery, and got the same result. It didn’t make any sense. Everything that I’ve seen says that galleries link to the attachment page, and only to the file if you specify them to. That wasn’t how it was working on this site, and there was no indication of why.

So, I did some searching, and found this support thread on the WordPress support forums that answered my question.

It turns out that there’s a whole lot more settings available then are in the admin area by default. All you need to do is go to:


That’s where you’ll see everything, and that’s where this setting was hiding.

All I had to do was change the value for image_default_link_type to 'file' and saved it.

And then… it still didn’t work!

As of this point I’m still trying to figure out why this is happening, but I’ll be updating this post as I find out more…

Leave a Reply

Your email address will not be published. Required fields are marked *