Add functions to extract a URL from an arbitrary string, HTML, or the current $post — at Version 4
|Reported by:||wonderboymusic||Owned by:|
|Component:||Post Formats||Keywords:||has-unit-tests needs-codex|
Description (last modified by wonderboymusic)
My post has a format of "link"
- My post has format meta for URL
- OR - My post content is a URL
- OR - My post contains an <a> tag with an href
- OR - My post content is a URL followed by new line(s) and commentary
An arbitrary string might be only a URL, a URL with some commentary, or a blob of HTML that might contain an <a> with an href attribute
Introduce the_link() and get_the_link( $id = 0 ) which will arbitrarily extract a URL from a post's content.
Introduce get_content_link( &$content, $remove = false ) to find a URL in an arbitrary string meeting the above criteria and optionally remove the found URL if it wasn't embedded in HTML content.