The oEmbed field provides an interactive component for embedding videos, images, tweets, audio, and other content. This field makes use of the native WordPress oEmbed functionality.

How to use it

Select the oEmbed field from your field group.

Displaying "raw" value

By default, the Meta vendors turn the oEmbed field value into an iframe element automatically using the built-in WP feature.

In some cases, you may need to get the raw value, the link itself to display alone, or in combination with the iframe.

In this case, you can use the 'raw_value' property.

<a href="{{ my_oembed.raw_value }}">Watch video</a>

You're free to mix both at the same time, so you can have:

<div>{{ my_oembed.value|raw }}</div>
<a href="{{ my_oembed.raw_value }}">Watch video</a>

When the first will display the iframe itself, and the second will display the watch link.

Note: for the first case, you should use the 'raw' Twig filter, otherwise the iframe's markup will be escaped.

Last updated