I have a new oEmbed field created in ACF PRO 5.1 and I have the default code in my custom template PHP file.
I am able to enter a YouTube video shortcode URL into the new field and it will display perfectly on my site page. But when I enter an Animoto video shortcode URL into the field it will not display and in fact the URL is not even included in the code to render the page.
Does anyone know why YouTube works but not Animoto? I can enter the Animoto URL directly into content area of a Page/Post and it will work but not when it’s entered into the ACF custom field on the Page/Post.
I have also noticed that when I enter a YouTube video shortcode in the field on the Page it disappears and the video does not display in the box. And when I enter an Animoto video shortcut URL into the field on the Page it remains visible and the video starts to play in the box below the field.
// get iframe HTML
$iframe = get_field('oembed');
// use preg_match to find iframe src
preg_match('/src="(.+?)"/', $iframe, $matches);
$src = $matches;
// add extra params to iframe src
$params = array(
'controls' => 0,
'hd' => 1,
'autohide' => 1
$new_src = add_query_arg($params, $src);
$iframe = str_replace($src, $new_src, $iframe);
// add extra attributes to iframe html
$attributes = 'frameborder="0"';
$iframe = str_replace('></iframe>', ' ' . $attributes . '></iframe>', $iframe);
// echo $iframe
2022 was a big year for Advanced Custom Fields, with more capabilities, a new generation of ACF Blocks, a refreshed UI, and a new home. Our year in review post looks at advancements we’ve made and offers a glimpse of the future. https://t.co/HahJUCcyH4