Make media file default over attachment page in wordpress.

If like me you have had serious issues with how WordPress handles galleries, namely with WordPress defaulting your galleries to attachment pages then never fear because this Web developing WordPress wizard has consolidated some information on fixes for your problem. The issue stems from WordPress totally disrespecting something about the [link] attribute in media.php and I am told they are working on a fix in the near future. In the meantime there are a couple of things you can do about it:

1. Go to the gallery itself in the post / page and switch the link attribute to “attachment” and then back to “media file” and the problem magically dissappears.

2. Manually put the attribute into the shortcode. Do this by finding the shortcode in the code part of your age and post and then change it to 

3. Both of these solutions work if you are adding new galleries using the usual UI, however what if you want to add galleries through a 3rd party application or if you already have 500 galleries and need them changed back. If like me you hardly ever add an attachment page to your images and always use a media file here is a quick and easy solution:

Find wp-media.php in /wp-includes/, find the line that reads something like: “wp_get_attachment_link( $id, $size, true, false );” (line 786 in 3.6) and replace the first true with false (so it would read “wp_get_attachment_link( $id, $size, false, false”);. Hey presto alah kazam and the option to have an attachment page disappears reverting all of your links back to media files.

Big thanks to these posts for providing the information:

http://wordpress.org/support/topic/gallery-media-file-link-not-working-as-default http://finkaboutit.com/how-to-get-rid-of-the-attachment-thing-on-your-images/
Comments are closed.
* required