Opened 7 years ago
Closed 7 years ago
#41299 closed defect (bug) (fixed)
oEmbed proxy fails to forward maxwidth and maxheight params
Reported by: | westonruter | Owned by: | westonruter |
---|---|---|---|
Milestone: | 4.8.1 | Priority: | normal |
Severity: | normal | Version: | 4.8 |
Component: | Embeds | Keywords: | has-patch has-unit-tests commit fixed-major |
Focuses: | rest-api | Cc: |
Description
oEmbed uses the maxwidth
and maxheight
params, and the oEmbed proxy endpoint added in core as of #40450 uses the same. However, it turns out that that WP_oEmbed::fetch()
uses width
and height
instead. So currently passing these maxwidth
and maxheight
params have no effect. This is causing a problem in Gutenberg where the oEmbed needs to be written into a sandbox iframe that has specific dimensions: https://github.com/WordPress/gutenberg/pull/1688#issuecomment-314862861
Attachments (2)
Change History (15)
This ticket was mentioned in Slack in #core by westonruter. View the logs.
7 years ago
#4
@
7 years ago
Shouldn't the unset( $args['_wpnonce'] );
part be handled by #41048? Or do you want to close that one as a duplicate?
#5
@
7 years ago
@swissspidy Yes, it can be committed as part of #41048. I wasn't aware of that other ticket when I was making this patch, so I was just going to sneak it in.
#6
@
7 years ago
- Keywords commit added
@swissspidy does 41299.1.diff look good to you?
Build passes: https://travis-ci.org/xwp/wordpress-develop/builds/253005279
#8
follow-up:
↓ 10
@
7 years ago
Sorry, I just saw that you pinged me for review here. Code looks good and fixes the related Gutenberg issue mentioned in the OP. I tested as follows:
- Added the
?maxwidth=
parameter in the Gutenberg code - Loaded various embeds with and without this patch
- Before loading each embed, clear the cached results by running
foreach ( $wpdb->get_results("SELECT option_name FROM $wpdb->options WHERE option_name LIKE '_transient%oembed%'") as $row ) { error_log( $row->option_name ); delete_option( $row->option_name ); }
inwp shell
+1 for commit.
#9
@
7 years ago
- Owner changed from jnylen0 to westonruter
- Status changed from reviewing to accepted
#10
in reply to:
↑ 8
@
7 years ago
Replying to jnylen0:
- Before loading each embed, clear the cached results by running
foreach ( $wpdb->get_results("SELECT option_name FROM $wpdb->options WHERE option_name LIKE '_transient%oembed%'") as $row ) { error_log( $row->option_name ); delete_option( $row->option_name ); }
inwp shell
BTW, you can also use wp transient delete --all
.
https://github.com/xwp/wordpress-develop/pull/239