WordPress.org

Make WordPress Core

Ticket #16996: 16996-5.diff

File 16996-5.diff, 1.3 KB (added by jacobwg, 7 years ago)

Passes custom params from shortcode and URL - we need to check to see if we need to filter these params (it also currently passes the discover arg to the request which the oEmbed provider ignores)

  • wp-includes/media.php

     
    13441344                $height = 700;
    13451345
    13461346        return apply_filters( 'embed_defaults', array(
    1347                 'width'  => $width,
    1348                 'height' => $height,
     1347                'maxwidth'  => $width,
     1348                'maxheight' => $height,
    13491349        ) );
    13501350}
    13511351
  • wp-includes/class-oembed.php

     
    8989                                break;
    9090                        }
    9191                }
     92               
     93                $args = wp_parse_args( $args, wp_parse_args( parse_url( $url, PHP_URL_QUERY ), array() ) );
    9294
    9395                if ( !$provider && $args['discover'] )
    9496                        $provider = $this->discover( $url );
     
    165167        function fetch( $provider, $url, $args = '' ) {
    166168                $args = wp_parse_args( $args, wp_embed_defaults() );
    167169
    168                 $provider = add_query_arg( 'maxwidth', $args['width'], $provider );
    169                 $provider = add_query_arg( 'maxheight', $args['height'], $provider );
    170170                $provider = add_query_arg( 'url', urlencode($url), $provider );
     171                $provider = add_query_arg( apply_filters( 'oembed_params_before_fetch', $args, $url, $provider ), $provider );
    171172
    172173                foreach( array( 'json', 'xml' ) as $format ) {
    173174                        $result = $this->_fetch_with_format( $provider, $format );