[wp-trac] [WordPress Trac] #65082: WP_oEmbed()->fetch() uses wp_embed_defaults() incorrectly

WordPress Trac noreply at wordpress.org
Thu Apr 16 20:18:25 UTC 2026


#65082: WP_oEmbed()->fetch() uses wp_embed_defaults() incorrectly
--------------------------+-----------------------------
 Reporter:  sanchothefat  |      Owner:  (none)
     Type:  defect (bug)  |     Status:  new
 Priority:  normal        |  Milestone:  Awaiting Review
Component:  Embeds        |    Version:
 Severity:  normal        |   Keywords:
  Focuses:                |
--------------------------+-----------------------------
 In the `fetch()` method of `WP_oEmbed()` it's expecting an array with
 `width` and `height` keys however `wp_embed_defaults()` returns a
 compacted numerically indexed array.

 The net result is that the provider always has `maxwidth` and `maxheight`
 values of 0, and embeds come out very small.

 Another compounding problem is that block themes don't necessarily declare
 `$contentwidth` either, so the net result is small embeds that don't fill
 their containers.

 Offending code:

 {{{

         public function fetch( $provider, $url, $args = '' ) {
                 $args = wp_parse_args( $args, wp_embed_defaults( $url ) );

                 $provider = add_query_arg( 'maxwidth', (int)
 $args['width'], $provider );
                 $provider = add_query_arg( 'maxheight', (int)
 $args['height'], $provider );

 }}}

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


More information about the wp-trac mailing list