Created
July 17, 2014 22:55
-
-
Save priscillamc/75a11ac18b9d674aef07 to your computer and use it in GitHub Desktop.
WordPress snippet. Link images and documents to the file instead of the attachment page. This also changes the 'View' link in the Media Library admin screen. Add to a new plugin file or to the functions.php in your theme.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Link to attachments instead of attachment pages | |
function pmc_attachment_link( $link, $post_id ){ | |
return wp_get_attachment_url( $post_id ); | |
} | |
add_filter( 'attachment_link', 'pmc_attachment_link', 10, 2 ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment