get_url_in_content() WP 3.6.0
Extract and return the first URL from passed content.
Хуков нет.
Возвращает
Строку/false. The found URL.
Использование
get_url_in_content( $content );
- $content(строка) (обязательный)
- A string which might contain a URL.
Список изменений
С версии 3.6.0 | Введена. |
Код get_url_in_content() get url in content WP 5.6.2
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;
}