Advertisements

twentyeleven_url_grabber

Definition:
function twentyeleven_url_grabber() {}

Return the URL for the first link found in the post content.

Return values

returns:URL or false when no link is present.

Source code

function twentyeleven_url_grabber() {

	if ( ! preg_match( '/<a\s[^>]*?href=[\'"](.+?)[\'"]/is', get_the_content(), $matches ) )

		return false;



	return esc_url_raw( $matches[1] );

}

14761

Advertisements

No comments yet... Be the first to leave a reply!

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: