Custom Fields
Support MB Views Youtube link in post.content doesn't render in a MB view

  • Creator
  • #27298
    Resolved Henri

    Hi Metabox,

    I have a youtube embeded in the post.content. When I don't use a MB view to display the page, it shows the text and the video. However, when I use a MB view and post the content using the following field:
    {{ post.content }}
    it does show the text but doesn't render the video, it only shows the url of the video. Is this a bug? How can I resolve this?

    Kind regards, Henri

Viewing 4 replies - 1 through 4 (of 4 total)
  • Author
  • #27306
    Long Nguyen


    It's the normal behavior because the data is saved in the database is the raw value like this

    <!-- wp:embed {"url":"","type":"video","providerNameSlug":"youtube","responsive":true,"className":"wp-embed-aspect-16-9 wp-has-aspect-ratio"} -->
    <figure class="wp-block-embed is-type-video is-provider-youtube wp-block-embed-youtube wp-embed-aspect-16-9 wp-has-aspect-ratio"><div class="wp-block-embed__wrapper">
    <!-- /wp:embed -->

    then Block editor support showing the video on the frontend, but the MB Views only support to show the raw value. You can change to the embed code <iframe> to show the Youtube video via MB Views.


    Hi Long,

    Thanks for you answer. I don't know how I can achieve that. The video is used in the Gutenberg editor as part of the content. So I have text, some images and then the video and then some text again. So when I echo post.content this content all gets displayed, except for the video. If I wrap the post.content in iframe tags only an empty box gets displayed. So how can I target only the video url in existing content with the MB view to wrap that in an iframe tag?

    Long Nguyen

    You can use the block Custom HTML and insert the embedded code of Youtube when editing the content. Screenshot


    Using the HTML block makes sense. It does require me to go into each existing post though to change the Youtube link. This is not ideal, but if there is no workaround then I'll have to see how I'm going to fix this.

Viewing 4 replies - 1 through 4 (of 4 total)
  • You must be logged in to reply to this topic.