Uses
Uses | Description |
---|---|
wp-includes/formatting.php: esc_url_raw() | Performs esc_url() for database usage. |
Extract and return the first URL from passed content.
(string) (Required) A string which might contain a URL.
(string|false) The found URL.
File: wp-includes/formatting.php
function get_url_in_content( $content ) { if ( empty( $content ) ) { return false; } if ( preg_match( '/<a\s[^>]*?href=([\'"])(.+?)\1/is', $content, $matches ) ) { return esc_url_raw( $matches[2] ); } return false; }
Version | Description |
---|---|
3.6.0 | Introduced. |
© 2003–2019 WordPress Foundation
Licensed under the GNU GPLv2+ License.
https://developer.wordpress.org/reference/functions/get_url_in_content