Skip to content

Commit 3b060c1

Browse files
committed
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
1 parent 1061a15 commit 3b060c1

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

src/wp-includes/class-wp-embed.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -142,6 +142,10 @@ public function unregister_handler( $id, $priority = 10 ) {
142142
public function shortcode( $attr, $url = '' ) {
143143
$post = get_post();
144144

145+
if ( empty( $url ) && ! empty( $attr['src'] ) ) {
146+
$url = $attr['src'];
147+
}
148+
145149
if ( empty( $url ) )
146150
return '';
147151

0 commit comments

Comments
 (0)