Skip to content

Instantly share code, notes, and snippets.

@wpspeak
Created June 29, 2013 18:33
Show Gist options
  • Save wpspeak/5892166 to your computer and use it in GitHub Desktop.
Save wpspeak/5892166 to your computer and use it in GitHub Desktop.
Link post title to external link - works best for link post format
<?php
// Link post title to external link
function afn_link_filter($link, $post) {
if (has_post_format('link', $post) && get_post_meta($post->ID, 'LinkFormatURL', true)) {
$link = get_post_meta($post->ID, 'LinkFormatURL', true);
}
return $link;
}
add_filter('post_link', 'afn_link_filter', 10, 2);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment