Uma área de pesquisa sobre o WordPress para devs e autores do tema



wp_extract_urls ›

Desde3.7.0
Obsoleton/a
wp_extract_urls ( $content )
Parâmetros:
  • (string) $content Content to extract URLs from.
    Required: Yes
Retorna:
  • (array) URLs found in passed string.
Definido em:
Codex:

Use RegEx to extract URLs from arbitrary content.



Fonte

function wp_extract_urls( $content ) {
	preg_match_all(
		"#([\"']?)("
			. '(?:([\w-]+:)?//?)'
			. '[^\s()<>]+'
			. '[.]'
			. '(?:'
				. '\([\w\d]+\)|'
				. '(?:'
					. "[^`!()\[\]{};:'\".,<>«»“”‘’\s]|"
					. '(?:[:]\d+)?/?'
				. ')+'
			. ')'
		. ")\\1#",
		$content,
		$post_links
	);

	$post_links = array_unique( array_map( 'html_entity_decode', $post_links[2] ) );

	return array_values( $post_links );
}