Last active
February 29, 2024 12:02
-
-
Save Garconis/6d972904f1cfee0db3d1e4152c840f6f to your computer and use it in GitHub Desktop.
WordPress | remove dnt=1 parameter from Vimeo oEmbed iframe URL (jQuery method)
This file contains 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
// https://wordpress.org/support/topic/vimeo-oembed-now-has-dnt1-parameter/ | |
// replace the dnt=1 parameter that WordPress adds to the Vimeo player when using oEmbed | |
jQuery(document).ready(function($){ | |
// find any Vimeo iframe | |
$('iframe[src*="player.vimeo.com"]').each(function(){ | |
// get the src | |
var src = $(this).attr('src'); | |
// replace parameter with nothing | |
$(this).attr('src',src.replace('dnt=1&', '')); | |
}); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Alternative method via PHP function: https://gist.github.com/Garconis/092e7c2440be703703947869ef6a5f39