Making images in posts link to the image file rather than the attachment page

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 –

header('Location: ' . wp_get_attachment_url() );

Note – Call it inside WordPress loop.

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)