Is it possible to modify the default YouTube embed attributes string?

There is a filter with the same name as the function wp_embed_handler_youtube

https://developer.wordpress.org/reference/hooks/wp_embed_handler_youtube/

add_filter('wp_embed_handler_youtube', 'ehy_callback', 10, 4);

function ehy_callback($embed, $attr, $url, $rawattr){

   //make necessary changes here
   return $embed;
}

You can add the code in functions.php of your child theme.

Leave a Comment