Make WordPress Core

Changeset 28559


Ignore:
Timestamp:
05/23/2014 06:05:24 PM (11 years ago)
Author:
wonderboymusic
Message:

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.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/class-wp-embed.php

    r28510 r28559  
    142142    public function shortcode( $attr, $url = '' ) {
    143143        $post = get_post();
     144
     145        if ( empty( $url ) && ! empty( $attr['src'] ) ) {
     146            $url = $attr['src'];
     147        }
    144148
    145149        if ( empty( $url ) )
Note: See TracChangeset for help on using the changeset viewer.