Make WordPress Core

Changeset 41765


Ignore:
Timestamp:
10/05/2017 01:28:11 AM (6 years ago)
Author:
obenland
Message:

Widgets: Continue to use shortcode for some embeds

Renders YouTube and Vimeo embeds through WordPress' video shortcode.

See #42039.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/widgets/class-wp-widget-media-video.php

    r41759 r41765  
    122122        }
    123123
    124         if ( $attachment ) {
     124        $youtube_pattern = '#^https?://(?:www\.)?(?:youtube\.com/watch|youtu\.be/)#';
     125        $vimeo_pattern   = '#^https?://(.+\.)?vimeo\.com/.*#';
     126
     127        if ( $attachment || preg_match( $youtube_pattern, $src ) || preg_match( $vimeo_pattern, $src ) ) {
    125128            add_filter( 'wp_video_shortcode', array( $this, 'inject_video_max_width_style' ) );
    126129
Note: See TracChangeset for help on using the changeset viewer.