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] );



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: Logo

You are commenting using your 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 )

Connecting to %s

%d bloggers like this: