Created
March 9, 2017 09:55
-
-
Save msaari/9b5714b4bd25f504593da029f9bc66a6 to your computer and use it in GitHub Desktop.
the_permalink() replacement that uses attachment image URL instead of attachment page URL
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
<?php | |
function relevanssi_the_permalink_media() { | |
global $post; | |
if ( $post->post_type != "attachment" ) { | |
the_permalink(); | |
} | |
else { | |
echo wp_get_attachment_url($post->ID); | |
} | |
} | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment