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 5 replies - 1 through 5 (of 5 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.

    Matt V

    Hi there,

    I've been troubleshooting YouTube embeds for much of the afternoon, and I finally narrowed it down to MB Views and found this post.

    I don't know exactly how WP handles these embeds on the frontend, but is there a way to load or replicate the necessary script through Views, either as an HTML script tag or in the JS panel?

    I know my content editors are going to be using this embed functionality regularly, so I would love to find a way to give them a simple embed block rather than using an HTML block.

    Should I expect that this issue will be true with the rest of the embed blocks?

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