get_url_in_content()
最后更新于:2021-11-27 03:23:15
get_url_in_content( string$content)Extract and return the first URL from passed content.
参数
- $content
-
(string) (Required) A string which might contain a URL.
响应
(string|false) The found URL.
源文件
文件: gc-includes/formatting.php
function get_url_in_content( $content ) {
if ( empty( $content ) ) {
return false;
}
if ( preg_match( '/<as[^>]*?href=(['"])(.+?)1/is', $content, $matches ) ) {
return esc_url_raw( $matches[2] );
}
return false;
}