I followed the example in ACF document: https://www.advancedcustomfields.com/resources/oembed/#display-value-with-additional-attributes
`
$video = get_sub_field( ’embeded_video’ );
if ( $video ) {
// Add autoplay functionality to the video code
if ( preg_match(‘/src=”(.+?)”/’, $video, $matches) ) {
// Video source URL
$src = $matches[1];
// Add option to hide controls, enable HD, and do autoplay — depending on provider
$params = array(
‘controls’ => 0,
‘hd’ => 1,
‘autoplay’ => 1
);
$new_src = add_query_arg($params, $src);
$video = str_replace($src, $new_src, $video);
// add extra attributes to iframe html
$attributes = ‘frameborder=”0″‘;
$video = str_replace(‘></iframe>’, ‘ ‘ . $attributes . ‘></iframe>’, $video);
}
}
`
However, it rendered a string of code instead of an iframe with those attributes.
https://sample.wpengine.com/wp-content/uploads/2022/11/test-video.mp4?controls=0&hd=1&autoplay=1
Has anyone experienced this before? Could you help me, please?