$post_link = get_the_permalink();
if ( preg_match('/<a (.+?)>/', get_the_content(), $match) ) {
$link = array();
foreach ( wp_kses_hair($match[1], array('http')) as $attr) {
$link[$attr['name']] = $attr['value'];
}
$post_link = $link['href'];
}
http://wordpress.stackexchange.com/questions/13448/get-link-value-only-from-the-content
Leave a Reply