diff --git a/mu-plugins/plugin-tweaks/index.php b/mu-plugins/plugin-tweaks/index.php index acd96df3..b77aa929 100644 --- a/mu-plugins/plugin-tweaks/index.php +++ b/mu-plugins/plugin-tweaks/index.php @@ -13,3 +13,4 @@ require_once __DIR__ . '/stream.php'; require_once __DIR__ . '/incompatible-plugins.php'; require_once __DIR__ . '/gutenberg.php'; +require_once __DIR__ . '/youtube-shortcode.php'; diff --git a/mu-plugins/plugin-tweaks/youtube-shortcode.php b/mu-plugins/plugin-tweaks/youtube-shortcode.php new file mode 100644 index 00000000..5db4837b --- /dev/null +++ b/mu-plugins/plugin-tweaks/youtube-shortcode.php @@ -0,0 +1,54 @@ + '100%', + 'height' => false, + 'title' => 'YouTube video player', + ); + $args = shortcode_atts( $defaults, $attr ); + + $html_attrs = ''; + foreach ( $args as $name => $value ) { + if ( $value ) { + $html_attrs .= $name . '="' . esc_attr( $value ) . '" '; + } + } + + return sprintf( + // `allow` settings copied from youtube-provided embed code. + '', + esc_url( $content ), + $html_attrs + ); +}