diff --git a/src/wp-admin/js/widgets/media-video-widget.js b/src/wp-admin/js/widgets/media-video-widget.js index 4ad17871fa..8c5563164d 100644 --- a/src/wp-admin/js/widgets/media-video-widget.js +++ b/src/wp-admin/js/widgets/media-video-widget.js @@ -111,15 +111,17 @@ } control.fetchEmbedDfd = jQuery.ajax({ - url: 'https://noembed.com/embed', + url: wp.media.view.settings.oEmbedProxyUrl, data: { url: control.model.get( 'url' ), maxwidth: control.model.get( 'width' ), - maxheight: control.model.get( 'height' ) + maxheight: control.model.get( 'height' ), + _wpnonce: wp.media.view.settings.nonce.wpRestApi, + discover: false }, type: 'GET', - crossDomain: true, - dataType: 'json' + dataType: 'json', + context: control }); control.fetchEmbedDfd.done( function( response ) { diff --git a/src/wp-admin/js/widgets/media-widgets.js b/src/wp-admin/js/widgets/media-widgets.js index 4ce0f3d850..c45e9ee954 100644 --- a/src/wp-admin/js/widgets/media-widgets.js +++ b/src/wp-admin/js/widgets/media-widgets.js @@ -182,15 +182,17 @@ wp.mediaWidgets = ( function( $ ) { } embedLinkView.dfd = $.ajax({ - url: 'https://noembed.com/embed', // @todo Replace with core proxy endpoint once committed. + url: wp.media.view.settings.oEmbedProxyUrl, data: { url: embedLinkView.model.get( 'url' ), maxwidth: embedLinkView.model.get( 'width' ), - maxheight: embedLinkView.model.get( 'height' ) + maxheight: embedLinkView.model.get( 'height' ), + _wpnonce: wp.media.view.settings.nonce.wpRestApi, + discover: false }, type: 'GET', - crossDomain: true, - dataType: 'json' + dataType: 'json', + context: embedLinkView }); embedLinkView.dfd.done( function( response ) {