Skip to content

Instantly share code, notes, and snippets.

Created May 23, 2013 15:26
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save anonymous/5636916 to your computer and use it in GitHub Desktop.
Save anonymous/5636916 to your computer and use it in GitHub Desktop.
Filter Pay with a Like URL to use 'shorturl' post meta
function my_filter_pwal_url_to_like( $url_to_like ) {
// Try to determine the post_id from the URL. Does not always work
$post_id = url_to_postid( $url_to_like );
// IF we find a match then use the post_id to look up the post meta key 'shorturl'
if (intval($post_id) > 0) {
$shorturl = get_post_meta($post_id, 'shorturl', true);
if (!empty($shorturl))
return $shorturl;
}
return $url_to_like;
}
add_filter( 'pwal_url_to_like', 'my_filter_pwal_url_to_like');
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment