[wp-trac] [WordPress Trac] #32353: Extend oEmbed parameters support in media modal

WordPress Trac noreply at wordpress.org
Tue May 12 08:15:36 UTC 2015


#32353: Extend oEmbed parameters support in media modal
----------------------------+-----------------------------
 Reporter:  ramiy           |      Owner:
     Type:  enhancement     |     Status:  new
 Priority:  normal          |  Milestone:  Awaiting Review
Component:  Media           |    Version:  trunk
 Severity:  normal          |   Keywords:
  Focuses:  administration  |
----------------------------+-----------------------------
 [http://oEmbed.com oEmbed] is great! But it's not customizable like
 [https://codex.wordpress.org/Shortcode shortcodes]. The
 [https://codex.wordpress.org/Shortcode_API Shortcode API] allows me to
 register custom parameters, the current oEmbed system does not.

 Many oEmbed providers support custom parameters through the oembed
 endpoint. This way, you get customized ready-to use html code. But
 WordPress doesn't support it (Yet!).

 WordPress 4.2 made the first step towards custom oembed parameters. 4.2
 introduced inline editing of **width** and **height** parameters while
 previewing an embedded item in the media modal. When you edit embedded
 items, wordpress wraps the embedded item url in the visual editor with
 **[embed]** shortcode ([https://codex.wordpress.org/Embed_Shortcode more
 info]).

 The next step should be adding custom parameters to each provider while
 register new oEmbed endpoints.

 === Default oEmbed values ===

 To set default oEmbed values:

 {{{
 $youtube_oembed_params = array(
         'width'    => '600',
         'height'   => '400',
         'showinfo' => 'true',
         'autoplay' => 'false',
         'mute'     => 'false',
 );
 wp_oembed_add_provider(
         '#https?://(www\.)?youtube\.com/watch.*#i',
         'https://www.youtube.com/oembed',
         true,
         $youtube_oembed_params   // The new param
 );
 }}}

 === Editing embedded items ===

 When editing embedded items in the media modal, the custom parameters will
 be added to the **[embed]** shortcode:

 {{{
 [embed width="400" height="300" showinfo="false" autoplay="true"
 mute="true"]https://youtube.com/...[/embed]
 }}}

--
Ticket URL: <https://core.trac.wordpress.org/ticket/32353>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list