WordPress.org

Make WordPress Core

Opened 2 months ago

#54468 new enhancement

Apply aspect ratio classes to wp_oembed_get when theme_supports('responsive-embeds') is added

Reported by: eclev91 Owned by:
Milestone: Awaiting Review Priority: normal
Severity: normal Version: trunk
Component: Embeds Keywords:
Focuses: Cc:

Description

The Gutenberg embed block supports [adding responsive wrappers around embeds that are cognizant of the embed's aspect ratio](https://github.com/WordPress/gutenberg/blob/v11.9.1/packages/block-library/src/embed/util.js#L185). Without creating fixed-width columns, the embed will fill its container at the interpreted aspect ratio.

If you're still writing PHP templates, you're using wp_oembed_get, which does not support this. [This ticket](https://core.trac.wordpress.org/ticket/34928) suggests that some JS fires to adjust the height on iframes on window resize, but that's a somewhat different issue, becoming important after the embed has been rendered. That ticket also suggests that an embed expanding to fill its container is undesirable and not in-line with oEmbed's specification, but whoever designed the Gutenberg block must have had a different interpretation of that spec.

Would be great if WordPress oEmbeds behaved the same however you create them.

Change History (0)

Note: See TracTickets for help on using tickets.