Read the `src` attribute for the `[embed]` shortcode if the shortcode's body is empty.

These work:
`[embed src="https://www.youtube.com/watch?v=ZqD-LPOWIT0"]`
`[embed src="https://www.youtube.com/watch?v=ZqD-LPOWIT0"][/embed]`

If you do:
`[embed src="https://www.youtube.com/watch?v=ZqD-LPOWIT0"]http://any-other-url.com[/embed]`

... "http://any-other-url.com" will be the URL that is parsed.

Props kovshenin, aaroncampbell for making initial patches.
Fixes #24456.



git-svn-id: https://develop.svn.wordpress.org/trunk@28559 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Scott Taylor 2014-05-23 18:05:24 +00:00
parent 1061a15eaf
commit 3b060c1931
1 changed files with 4 additions and 0 deletions

View File

@ -142,6 +142,10 @@ class WP_Embed {
public function shortcode( $attr, $url = '' ) {
$post = get_post();
if ( empty( $url ) && ! empty( $attr['src'] ) ) {
$url = $attr['src'];
}
if ( empty( $url ) )
return '';