From 3214d6d32512a533a798a5d0792ff1dee6c5052e Mon Sep 17 00:00:00 2001 From: Scott Taylor Date: Fri, 23 May 2014 18:06:13 +0000 Subject: [PATCH] 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. Built from https://develop.svn.wordpress.org/trunk@28559 git-svn-id: http://core.svn.wordpress.org/trunk@28385 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- wp-includes/class-wp-embed.php | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/wp-includes/class-wp-embed.php b/wp-includes/class-wp-embed.php index f83d280648..fbcd51713f 100644 --- a/wp-includes/class-wp-embed.php +++ b/wp-includes/class-wp-embed.php @@ -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 '';