Add this to your child theme’s functions file after modification:
add_filter('embed_handler_html', function( $html ) {
$title = 'YouTube Video';
return str_replace(
'src=',
'title="' . $title . '" src=',
$html
);
});
Thread Starter
rkim
(@rkim)
Thanks Samuel! However this doesn’t seem to be working?
We are also using the oembed_filter to insert the youtube links onto our pages/posts:
function oembed_filter( $html ) {
return '<figure class="video-container">' . $html . '</figure>';
}
Would you say this will be in conflict with the code snippet given?
Also is there a way to grab the actual title of the youtube video and have that be set as the $title variable? Since we do house multiple videos across our site.
Hi,
Can you fix this problem? I’m interesting by accesibility
Thanks!!!