diff --git a/src/js/_enqueues/wp/widgets/media.js b/src/js/_enqueues/wp/widgets/media.js
index 2ee00a826c..08e51f0278 100644
|
a
|
b
|
wp.mediaWidgets = ( function( $ ) { |
| 238 | 238 | } |
| 239 | 239 | |
| 240 | 240 | // Support YouTube embed links. |
| 241 | | re = /https?:\/\/www\.youtube\.com\/embed\/([^/]+)/; |
| | 241 | re = /https?:\/\/www\.youtube(?:-nocookie)?\.com\/embed\/([^/]+)/; |
| 242 | 242 | youTubeEmbedMatch = re.exec( url ); |
| 243 | 243 | if ( youTubeEmbedMatch ) { |
| 244 | 244 | url = 'https://www.youtube.com/watch?v=' + youTubeEmbedMatch[ 1 ]; |
diff --git a/src/js/media/views/embed/link.js b/src/js/media/views/embed/link.js
index f42d494558..bc9928997a 100644
|
a
|
b
|
EmbedLink = wp.media.view.Settings.extend(/** @lends wp.media.view.EmbedLink.pro |
| 49 | 49 | } |
| 50 | 50 | |
| 51 | 51 | // Support YouTube embed urls, since they work once in the editor. |
| 52 | | re = /https?:\/\/www\.youtube\.com\/embed\/([^/]+)/; |
| | 52 | re = /https?:\/\/www\.youtube(?:-nocookie)?\.com\/embed\/([^/]+)/; |
| 53 | 53 | youTubeEmbedMatch = re.exec( url ); |
| 54 | 54 | if ( youTubeEmbedMatch ) { |
| 55 | 55 | url = 'https://www.youtube.com/watch?v=' + youTubeEmbedMatch[ 1 ]; |
diff --git a/src/wp-includes/media.php b/src/wp-includes/media.php
index 456cd7c988..85bd031e60 100644
|
a
|
b
|
function wp_video_shortcode( $attr, $content = '' ) { |
| 3407 | 3407 | |
| 3408 | 3408 | $is_vimeo = false; |
| 3409 | 3409 | $is_youtube = false; |
| 3410 | | $yt_pattern = '#^https?://(?:www\.)?(?:youtube\.com/watch|youtu\.be/)#'; |
| | 3410 | $yt_pattern = '#^https?://(?:www\.)?(?:youtube(?:-nocookie)?\.com/(?:watch|embed)|youtu\.be/)#'; |
| 3411 | 3411 | $vimeo_pattern = '#^https?://(.+\.)?vimeo\.com/.*#'; |
| 3412 | 3412 | |
| 3413 | 3413 | $primary = false; |
diff --git a/src/wp-includes/widgets/class-wp-widget-media-video.php b/src/wp-includes/widgets/class-wp-widget-media-video.php
index 51033b4df6..131a14affc 100644
|
a
|
b
|
class WP_Widget_Media_Video extends WP_Widget_Media { |
| 126 | 126 | return; |
| 127 | 127 | } |
| 128 | 128 | |
| 129 | | $youtube_pattern = '#^https?://(?:www\.)?(?:youtube\.com/watch|youtu\.be/)#'; |
| | 129 | $youtube_pattern = '#^https?://(?:www\.)?(?:youtube(?:-nocookie)?\.com/(?:watch|embed)|youtu\.be/)#'; |
| 130 | 130 | $vimeo_pattern = '#^https?://(.+\.)?vimeo\.com/.*#'; |
| 131 | 131 | |
| 132 | 132 | if ( $attachment || preg_match( $youtube_pattern, $src ) || preg_match( $vimeo_pattern, $src ) ) { |