Make WordPress Core

Opened 8 years ago

Closed 7 years ago

#24456 closed defect (bug) (fixed)

Add src attribute to embed shortcode

Reported by: aaroncampbell Owned by: wonderboymusic
Milestone: 4.0 Priority: normal
Severity: normal Version:
Component: Embeds Keywords: has-patch
Focuses: Cc:


The embed shortcode takes URL as its content, but a/v ones take an attribute — make both for both?

See: http://make.wordpress.org/core/2013/05/29/post-formats-ui-is-exiting-core-will-live-as-a-plugin/

Attachments (3)

24456.diff (1.6 KB) - added by kovshenin 8 years ago.
24456.2.diff (398 bytes) - added by aaroncampbell 8 years ago.
24456.3.diff (442 bytes) - added by wonderboymusic 7 years ago.

Download all attachments as: .zip

Change History (11)

#2 @wonderboymusic
8 years ago

one caveat here - for video, if you want to add subtitles (which we don't support yet - MediaElement does), the body of the shortcode might be a good place to put it:

<track kind="subtitles" src="subtitles.srt" srclang="en" />

Otherwise, HTML frags will have to be passed to the shortcode as attributes. Granted, one could filter 'wp_mediaelement_fallback', but that sounds super ghetto

8 years ago

#3 @kovshenin
8 years ago

24456.diff adds support for URL as the shortcode content for audio and video callbacks, as well as a src attribute to the embed shortcode callback. The src attribute (if not empty) has a higher priority in all three shortcodes.

Last edited 8 years ago by kovshenin (previous) (diff)

#4 @wonderboymusic
8 years ago

I am going to suggest not doing this - see my above comment about <video>, which can contain <track> in its body

#5 @nacin
8 years ago

  • Component changed from Media to Embeds
  • Milestone changed from 3.6 to Future Release
  • Summary changed from Make audio/video shortcodes consistent with embed to Add src attribute to embed shortcode

I agree with wonderboymusic, so does MarkJaquith per IRC.

In that case, maybe we can add 'src' to [embed].

Punting out of 3.6 as it's not a necessity.

#6 @aaroncampbell
8 years ago

24456.2.diff is just an update to the patch by kovshenin with only the src attribute for embed part

#7 @wonderboymusic
7 years ago

  • Keywords has-patch added; needs-patch removed
  • Milestone changed from Future Release to 4.0

24456.3.diff is a refresh and only sets the URL from attribute if the body (where the URL typically resides) is empty.

#8 @wonderboymusic
7 years ago

  • Owner set to wonderboymusic
  • Resolution set to fixed
  • Status changed from new to closed

In 28559:

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.

Note: See TracTickets for help on using tickets.