Tips and tricks
How to embed DynTube videos in LearnDash
A DynTube video goes into a LearnDash lesson as an ordinary iframe, pasted into a Custom HTML block. Two things decide whether it survives: the WordPress capability of the account doing the pasting, and whether the lesson is checked as a learner rather than only in the editor.
Updated 30 August 2026
Before you start
- The video is uploaded to DynTube and has finished processing. A video that is still processing has no playable stream yet, so the embed will render an empty player.
- The video has an embed key. Embed code is generated from it; where a video is missing one, the dashboard shows a notice instead of a snippet and no code can be copied.
- Your WordPress account can save raw HTML — see the capability boundary further down. On a standard single site that means an Administrator; on a multisite network only a Super Admin holds it by default.
- The LearnDash lesson (or topic) you want the video in already exists, so you are editing it rather than creating course structure at the same time.
Step 1 — copy the embed code from DynTube
- Open the video in the DynTube dashboard and choose Embed.
- Take the iframe snippet — it is the one marked Recommended.
- Copy it exactly, wrapper div included. The dashboard has already filled in that video’s embed key, its player host and its title.
The example here shows the same generated shape with the key written as YOUR_EMBED_KEY, so you can read what each part does before pasting your own. Copy the dashboard’s version rather than typing this one — your account may be served from a different player host.
<div style="position:relative;width:100%;overflow:hidden;padding-top:56.25%">
<iframe
style="position:absolute;top:0;left:0;bottom:0;right:0;width:100%;height:100%;border:none"
allow="autoplay; fullscreen"
allowfullscreen
src="https://dyn.tube/embed/video/YOUR_EMBED_KEY?playerId=dyntube-YOUR_EMBED_KEY"
title="Your video title"></iframe>
</div>The outer div is what makes this fit a LearnDash lesson column: it fills the width available and its 56.25% top padding reserves a 16:9 box, while the iframe is pinned to all four sides of it. There is no script to add and no initialisation step — each video is a self-contained snippet.
Change the title attribute to something that describes the video. Screen readers announce it to learners, and “Video” tells a listener nothing.
Step 2 — paste it into the LearnDash lesson
- In WordPress, open LearnDash LMS and go to Lessons — or Topics, if the video belongs to a topic.
- Open the lesson you want to edit.
- Place the cursor where the video should sit, type “/” to open the block inserter, and choose Custom HTML.
- Paste the whole snippet into the block, including the wrapper div.
- Use the block’s Preview toggle to confirm the player renders in the editor.
- Publish or Update the lesson.
Why a Custom HTML block, and who can use one
A paragraph or rich-text field is not raw HTML. WordPress sanitises what it saves there, and an iframe — or the style attribute the wrapper depends on — is exactly the kind of markup that gets removed. A Custom HTML block is the field that is meant to hold it.
Even in that block, WordPress only keeps raw HTML for users who hold the unfiltered_html capability. On a standard single site that is the Administrator role; on a multisite network it is restricted further, to Super Admins. An Editor or Author can open the block, paste the snippet and save without an error, and WordPress will still strip the iframe on the way in. If the embed disappears on save, this is the first thing to check — not the DynTube snippet.
Checking it worked
- Reopen the saved lesson in the editor and confirm the snippet is still intact. Sanitisation happens when the lesson is saved, so an embed that previewed correctly can still be gone afterwards.
- View the lesson as a learner — a logged-in enrolled account, or a second browser profile — rather than as the administrator who pasted it. The editor preview does not exercise the learner-side page.
- Start playback on that learner view. Rendering is not the same as playing.
- Open the same lesson on a phone. The wrapper should scale to the lesson column without a horizontal scrollbar, keeping its 16:9 shape.
If the player does not appear
| What you see | Likely cause | What to do |
|---|---|---|
| The snippet is gone after saving | The account that saved the lesson does not hold unfiltered_html, or a plugin sanitised the field. | Save the lesson from an account that holds the capability, and confirm no security plugin is filtering post content. |
| The iframe is there but the box has no height | The wrapper div — or its style attribute — was stripped while the iframe survived. | Re-paste the whole snippet. The iframe is absolutely positioned and has no size of its own without the wrapper. |
| It plays for you but not for learners | The lesson is being viewed from a host the project does not allow playback from, such as a staging or preview domain. | Add every host learners actually use to the project’s allowed domains. |
| Nothing renders at all | A content-security policy on the site is blocking frames from the player host. | Allow the player host in the site’s frame-src policy. |
| The player loads but never starts | The video has not finished processing. | Wait for the video to become ready in the dashboard, then reload the lesson. |
| The dashboard offers no snippet to copy | The video has no embed key, so the embed dialog shows a notice instead of code. | Resolve that with support. Do not hand-build a player URL — the embed key is the only identifier the snippet carries. |
Current LearnDash and embed behavior
- LearnDash controls who reaches the lesson; it does not control who reaches the video. A learner who copies the iframe can load it elsewhere unless the project restricts playback by domain.
- Domain restrictions protect embeds, not viewers. Someone already enrolled can still record their own screen.
- Each snippet carries one video’s embed key. Duplicating a lesson duplicates that key — re-copy the snippet if the new lesson should show a different video.
- Changing a project’s playback rules affects the videos it applies to, not the LearnDash lesson. After changing them, re-test the lesson as a learner.
Something missing or wrong here? Tell us and we will correct it. New to DynTube? Start with uploading and embedding.