# Custom block youtube video

**URL:** https://forum.pinegrow.com/t/custom-block-youtube-video/8150
**Category:** Support Forum Feedback
**Created:** [June 14, 2023, 10:27am UTC](https://forum.pinegrow.com/t/custom-block-youtube-video/8150 "2023-06-14T10:27:35Z")
**Posts on this page:** 6
**Page:** 1

<div class="post-metadata">

### Author: ![Roxy](https://avatars.discourse-cdn.com/v4/letter/r/53a042/32.png) [@Roxy](https://forum.pinegrow.com/u/Roxy)
#### Post date: [June 14, 2023, 10:27am UTC](https://forum.pinegrow.com/t/custom-block-youtube-video/8150/1 "2023-06-14T10:27:35Z")

</div>

Hi.

I need help on how to embed youtube video on custom block with iframe (if it is possible making block attributes to paste youtube iframe code).

Thanks.

 ![Screenshot 2023-06-14 at 12.25.58](https://canada1.discourse-cdn.com/flex036/uploads/pinegrow/original/2X/e/e58443662a616be0615d783aa31773cabd7d95de.png)

---

<div class="post-metadata">

### Author: ![Guido](https://yyz2.discourse-cdn.com/flex036/user_avatar/forum.pinegrow.com/guido/32/4958_2.png) [@Guido](https://forum.pinegrow.com/u/Guido)
#### Post date: [June 14, 2023, 11:50am UTC](https://forum.pinegrow.com/t/custom-block-youtube-video/8150/2 "2023-06-14T11:50:08Z")

</div>

Hi Roxy,

Yes that’s possible. I did it this way:

![image](https://canada1.discourse-cdn.com/flex036/uploads/pinegrow/original/2X/1/1c8c09bae080f0f1f1e8438c24ff7d73227d9990.png)

Here an example of the iframe code:

```auto
<iframe width="560" height="315" src="https://www.youtube-nocookie.com/embed/" title="YouTube video player" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share" allowfullscreen loading="lazy" class="player youtube__iframe"</iframe>

```

If you want to share a video you can enable privacy mode. I did that and that why it is youtube-nocookie

On the src i removed the id of the video. Then with the block attribute you can let the client add it’s own id.

Guido

---

<div class="post-metadata">

### Author: ![Roxy](https://avatars.discourse-cdn.com/v4/letter/r/53a042/32.png) [@Roxy](https://forum.pinegrow.com/u/Roxy)
#### Post date: [June 14, 2023, 1:47pm UTC](https://forum.pinegrow.com/t/custom-block-youtube-video/8150/3 "2023-06-14T13:47:44Z")

</div>

Thanks Guido…it works… 🙂

---

<div class="post-metadata">

### Author: ![Guido](https://yyz2.discourse-cdn.com/flex036/user_avatar/forum.pinegrow.com/guido/32/4958_2.png) [@Guido](https://forum.pinegrow.com/u/Guido)
#### Post date: [June 14, 2023, 1:58pm UTC](https://forum.pinegrow.com/t/custom-block-youtube-video/8150/4 "2023-06-14T13:58:05Z")

</div>

Hi Roxy,

Great! Glad i could offer some help 🙂

---

<div class="post-metadata">

### Author: ![adamslowe](https://yyz2.discourse-cdn.com/flex036/user_avatar/forum.pinegrow.com/adamslowe/32/4590_2.png) [@adamslowe](https://forum.pinegrow.com/u/adamslowe)
#### Post date: [June 19, 2023, 5:39pm UTC](https://forum.pinegrow.com/t/custom-block-youtube-video/8150/5 "2023-06-19T17:39:18Z")

</div>

Another option, although not specifically an iFrame, is to use a custom function with wp\_oembed\_get() and pass the URL along as a variable. I do this with custom fields on a few sites and it works great.

![image](https://canada1.discourse-cdn.com/flex036/uploads/pinegrow/original/2X/b/b766690541f11789d77b07941f90ec93a57101e5.png)

---

<div class="post-metadata">

### Author: ![madjedo](https://avatars.discourse-cdn.com/v4/letter/m/cc9497/32.png) [@madjedo](https://forum.pinegrow.com/u/madjedo)
#### Post date: [June 23, 2023, 2:07pm UTC](https://forum.pinegrow.com/t/custom-block-youtube-video/8150/6 "2023-06-23T14:07:22Z")

</div>

I did it with a inner block that only allows media embed. Then you can use default wordpress embed.
