In the example from the documentation on Craft 3 'Video Embedder' plugin:

{% set embed = craft.videoEmbedder.getEmbedUrl('https://www.youtube.com/watch?v=6xWpo5Dn254') %}

{% if embed | length %}
    <iframe src="{{ embed }}"></iframe>
{% endif %}

Can someone please give me full (i.e. total beginner!) instructions on how to get the URL to load.

2 Answers 2


Worked it out - just needed to use the right syntax, for example:

{% set embed = craft.videoEmbedder.getEmbedUrl(entry.videoEmbed) %}

{% if embed | length %}
<div class="embed-responsive embed-responsive--mb-l embed-responsive-16by9"><iframe src="{{ embed }}" width="100%" height="600" frameborder="0" webkitallowfullscreen mozallowfullscreen allowfullscreen></iframe></div>
{% endif %}

Unfortunately, it has causes a big PHP error if 'empty'...If you don’t have any content (i.e. it’s an optional field for someone to add a video embed to the page and the user chooses not to embed a video) it triggers a big PHP error:


<url> malformed

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.