Getting attachment post using wp_get_attachment_link
Yes, if you pass third ($permalink) parameter as true in wp_get_attachment_link() image will link to attachment’s page not image itself. You can use wp_get_attachment_link filter to change behavior of that parameter, but in this case it simply means overwriting whole function. Instead I would use wp_get_attachment_image() and get_permalink() UPDATE Maybe wp_get_attachment_image() would fit in this … Read more