Opened 9 years ago
Closed 9 years ago
#32353 closed enhancement (wontfix)
Extend oEmbed parameters support in media modal
Reported by: | ramiy | Owned by: | |
---|---|---|---|
Milestone: | Priority: | normal | |
Severity: | normal | Version: | 4.3 |
Component: | Embeds | Keywords: | |
Focuses: | administration | Cc: |
Description
oEmbed is great! But it's not customizable like shortcodes. The 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 (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]
Change History (6)
#3
follow-up:
↓ 4
@
9 years ago
- Keywords close added; needs-patch removed
This can be done by filtering oembed_fetch_url
and oembed_remote_get_args
- I don't think the args you want to add are generic enough to add to the embed shortcode attribute list. The attributes that are supported now are universal for all embeds.
#4
in reply to:
↑ 3
@
9 years ago
Replying to wonderboymusic:
I don't think the args you want to add are generic enough to add to the embed shortcode attribute list. The attributes that are supported now are universal for all embeds.
I don't want universal attributes. I want specific attributes. And each provider has it's own attributes.
#5
@
9 years ago
I don't want universal attributes. I want specific attributes. And each provider has it's own attributes.
That's why it doesn't make much sense to add this as part of core. Currently, you can edit width and height, two parameters officially allowed by the oEmbed specification.
All other params, like the one described for YouTube, are proprietary. Supporting these would lead to a couple of problems:
- Bad UX: The user sees different input fields when editing different URLs and has no idea why.
- Overly complex code: We'd need to determine, document and test all the params supported by the different providers
- Backwards compatibility: We don't know if these params will be supported all the time
I like the previous suggestions on the ticket, testing this as part of Shortcake would be very interesting. Besides that, this can be enabled through the mentioned filters.
+1 to closing this.
If you want to put together a pull request, we could accommodate this sort of enhancement in Shortcake quite easily: https://github.com/fusioneng/Shortcake/issues/327