If you are using a lightbox on your website, like I do on this page, it might be usefull to autoselect the option “Link to Media File” for Attachements.
This can be done without even coding a single line.
First step is to access the advanced options dashboard of wordpress. Just add this at the end of your domain:/wp-admin/options.php
You might have to enter your password again bevore you reach this page:

- Search for
image_default_link_type
. - Add “file” in the textbox next to it.
- Scroll all the way down.
- Save.
If you are already on it, you might be intressted to also autmatically adding classes to images. Check out the solution here.
Feel free to ask your questions in the comments.