> For the complete documentation index, see [llms.txt](https://wplake.gitbook.io/advanced-views/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://wplake.gitbook.io/advanced-views/display-content/meta-fields/content-fields/oembed.md).

# oEmbed

The oEmbed field type (e.g. [ACF oEmbed field](https://wplake.org/blog/acf-oembed/)) 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.

## Adding class to the iframe

&#x20;Since oembed contains the ready iframe tag, you can add a class attribute using the replace [Twig filter](/advanced-views/templates/template-engines/twig.md#filters), as shown below:

```twig
{% if oembed.value %}
  <div>
    {{ oembed.value|replace('<iframe ','<iframe class="my-class" ')|raw }}
  </div>
{% endif %}
```

## Enabling video autoplay

If you've embedded a video, you can enable autoplay so it starts as soon as readers open the page, without needing to click. To do this, add the `autoplay` argument to the iframe's `src` URL. The argument name may vary depending on the platform, but for YouTube, it's `autoplay=1`.

It can be done use the replace Twig filter, as shown below:

```twig
{{ oembed.value|replace({'" frameborder':'&autoplay=1" frameborder'})|raw }}
```

## Displaying "raw" value

By default, the Meta vendors turn the oEmbed field value into an iframe element automatically using the [built-in WP feature](https://developer.wordpress.org/reference/functions/wp_oembed_get/).

In some cases, you may need to get the raw value, the origin link itself to display alone, not turned into oembed and wrapper into iframe.

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

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

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

```twig
<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.

{% hint style="info" %}
Note: for the first case, you should use the ['raw' Twig filter](https://docs.advanced-views.com/templates/twig-templates#auto-escaping), otherwise the iframe's markup will be escaped.
{% endhint %}


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://wplake.gitbook.io/advanced-views/display-content/meta-fields/content-fields/oembed.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
