• FilipeOS

    (@filipeos)


    Hi,

    Like I saw on here I tried to use the code but it’s not working on the latest version of WP, any resolution for this? This is very annoying..

    Basically it’s hidding our Vimeo stats…

Viewing 3 replies - 1 through 3 (of 3 total)
  • mattyrob

    (@mattyrob)

    @filipeos

    WordPress cached embed data responses in the postmen table, it’s likely the at the function you are calling is being bypassed and cached data are being used. Try this query in PHPMyAdmin and check the stored data, I bet the ‘dot’ tags are in there.

    SELECT * FROMwp_postmetaWHEREmeta_keyLIKE '%_oembed%'

    You can delete those keys to force a refresh and check that your filter is working.

    Thread Starter FilipeOS

    (@filipeos)

    Hi,

    I got:

    [25-Apr-2020 12:23:52 UTC] PHP Fatal error:  Uncaught ArgumentCountError: Too few arguments to function dl_oembed(), 1 passed in /home4/choseni1/public_html/XXX/wp-includes/class-wp-hook.php on line 289 and exactly 3 expected in /home4/choseni1/public_html/XXX/wp-content/themes/powerlift-child/functions.php:151
    Stack trace:
    #0 /home4/choseni1/public_html/XXX/wp-includes/class-wp-hook.php(289): dl_oembed('https://vimeo.c...')
    #1 /home4/choseni1/public_html/XXX/wp-includes/plugin.php(206): WP_Hook->apply_filters('https://vimeo.c...', Array)
    #2 /home4/choseni1/public_html/XXX/wp-includes/class-wp-oembed.php(536): apply_filters('oembed_fetch_ur...', 'https://vimeo.c...', 'https://vimeo.c...', Array)
    #3 /home4/choseni1/public_html/XXX/wp-includes/class-wp-oembed.php(355): WP_oEmbed->fetch('https://vimeo.c...', 'https://vimeo.c...', Array)
    #4 /home4/choseni1/public_html/XXX/wp-includes/class-wp-oembed.php(400): WP_oEmbed->get_data('https://vimeo.c...', Array)
    #5 /home4/choseni1/public_html/ in /home4/choseni1/public_html/XXX/wp-content/themes/powerlift-child/functions.php on line 151

    for the code:

    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' );
    Moderator Samuel Wood (Otto)

    (@otto42)

    WordPress.org Admin

    Yes, that code would be incorrect.

    This would work:

    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', 10, 3);
    

    The missing 10,3 would be the problem.

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