The provider URL with the dnt query arg is filtered with ‘oembed_fetch_url’. You can remove the query arg by hooking this filter. Be sure any privacy policy you may have is clear that by using your site, your users will be tracked by Vimeo. If you have other embeds, verify the provider URL is for Vimeo before removing the dnt query arg.
Thread Starter
squibs
(@squibs)
Thanks for the help. I’ll give it a shot. Good advice on the privacy policy.
Thread Starter
squibs
(@squibs)
I thought this would do the trick if I put it in functions.php:
function dl_oembed ( $provider, $url, $args ) {
$url = remove_query_arg( 'dnt', $url );
return $url;
}
add_filter( 'oembed_fetch_url', 'dl_oembed' );
but no dice
Thread Starter
squibs
(@squibs)
Also tried
function dl_oembed ( $provider, $url, $args ) {
if ( strpos( $provider, 'vimeo.com' ) !== false) {
$args['dnt']=0;
}
return $url;
}
//add_filter( 'oembed_fetch_url', 'dl_oembed' );
You need to work on the $provider value. Working on other passed values will not affect them outside of the callback scope, they are only passed for information. I was thinking something like this (untested):
function dl_oembed ( $provider, $url, $args ) {
if ( strpos( $provider, 'vimeo.com' ) !== false)
$provider = remove_query_arg( 'dnt', $provider );
return $provider;
}
add_filter( 'oembed_fetch_url', 'dl_oembed' );
Thread Starter
squibs
(@squibs)
Thanks for taking the time out to suggest this – I’ll try it. I have a copy of the site on localhost now, so I can step through it with xDebug and monitor the $provider variable.
Thread Starter
squibs
(@squibs)
It works! Thanks so much.