Viewing 8 replies - 1 through 8 (of 8 total)
  • Moderator bcworkz

    (@bcworkz)

    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' );
    
    • This reply was modified 5 years, 10 months ago by Jose Castaneda.
    • This reply was modified 5 years, 10 months ago by Jose Castaneda. Reason: fixed code
    Moderator bcworkz

    (@bcworkz)

    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.

    Moderator bcworkz

    (@bcworkz)

    Cool! You’re welcome.

Viewing 8 replies - 1 through 8 (of 8 total)
  • The topic ‘Disabling Do Not Track for oembeds’ is closed to new replies.