-
-
Save k4zuki02h4t4/c4edb0de32b0998cd8ce58eefee224e3 to your computer and use it in GitHub Desktop.
[WordPress] Play YouTube video inline on iOS.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| /** | |
| * Play YouTube video inline on iOS. | |
| */ | |
| add_filter( 'oembed_dataparse', function ( $return, $data ) { | |
| if ( is_object( $data ) && 'YouTube' === $data->provider_name && ! empty( $data->html ) && is_string( $data->html ) ) { | |
| $return = preg_replace( '/src="([^"]+)"/', 'src="$1&playsinline=1"', $data->html ); | |
| } | |
| return $return; | |
| }, 10, 2 ); |
Author
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Plugin
https://github.com/visualive/va-youtube-playsinline