How to Embed a YouTube Video in WordPress from a Word Document
You write in Word. You drop a YouTube link into the draft. You import it into WordPress, and you get a blue underlined URL where the video should be.
Then you try the obvious fix: copy the embed code from YouTube's Share →
Embed dialog, paste the <iframe> into your document, import again. The
video is still missing, and now so is the iframe.
Here is what is actually happening, and the one-line change that fixes it.
Why the iframe disappears
WordPress keeps a list of HTML tags that are allowed in post content. Every
post is filtered against that list before it is saved, by a function called
wp_kses_post(). <iframe> is not on the list.
So when an iframe reaches post content, WordPress does not render it, sanitise it, or warn about it. It deletes the whole element and saves what is left. From the outside this looks like the importer lost your video. It did not: WordPress removed it, on purpose, a step later.
This is a reasonable rule. An iframe is a window to someone else's code running on your page. A document that could put arbitrary iframes into your site would be a straightforward way to attack it, and documents get emailed around.
What WordPress wants instead
WordPress has handled video since long before the block editor, through oEmbed. You give it a URL it recognises, and it asks the provider for the correct player and renders it for you.
In the block editor this is a core/embed block. The important part is that
the thing you supply is a plain URL, not markup. WordPress builds the
player itself, which is why it is safe and why it keeps working when YouTube
changes their embed code.
So the fix is not to paste more code. It is to paste less.
Put the link on its own line
In your Word document, put the video URL on a line by itself:
Here is the walkthrough for the new import screen.
https://www.youtube.com/watch?v=dQw4w9WgXcQ
The settings are covered from four minutes in.
Import that, and the middle line becomes a video player. The paragraphs above and below stay exactly as you wrote them.
Word will usually auto-format the URL into a blue underlined hyperlink the moment you press space or Enter. That is fine and changes nothing.
Links that stay links
A URL inside a sentence is left alone:
We explain it in this short video, which is worth watching.
If "this short video" links to YouTube, it stays a link. That is deliberate. Replacing three words in the middle of a sentence with a full-width player would wreck the paragraph, and you clearly meant those words to be read.
The rule is simple: a line containing only the URL becomes a video, anything else stays text.
Which links work
All of these are recognised and all produce the same player:
https://www.youtube.com/watch?v=VIDEO_ID
https://youtu.be/VIDEO_ID
https://www.youtube.com/shorts/VIDEO_ID
https://m.youtube.com/watch?v=VIDEO_ID
https://vimeo.com/VIDEO_ID
https://player.vimeo.com/video/VIDEO_ID
Extra tracking parameters are fine: a link copied from YouTube's share button
with ?feature=share&v=... on it still works.
If you already pasted an iframe, you do not need to go back and tidy your documents. An iframe from YouTube or Vimeo is recognised and converted to the same embed. Iframes from anywhere else are removed rather than kept, because WordPress would delete them at save time anyway and leaving them produces an empty gap in the post instead of an error.
Other video sites
Only YouTube and Vimeo are converted. A link to any other host stays an ordinary link.
That is a deliberate limit rather than an oversight. Converting a URL means every visitor's browser makes a request to that host when the page loads, and guessing which unfamiliar domains should be granted that is not a decision a document should be making on your behalf.
Turning it off
Settings → Video Embeds, in both the free plugin and Pro. It is on by default, because a pasted video link that silently stays a link is the surprising outcome, not the embed.
Turning it off makes every URL import as an ordinary link, exactly as before.
Where it works
Video embeds are in the free DocxToPost plugin from WordPress.org from version 1.2.4, and in DocxToWP Pro from 1.3.5.
In Pro the same rule applies across bulk imports, so a folder of a hundred documents with a video at the top of each one produces a hundred posts with working players, in one run.
Import Word documents with their videos intact
Video links become players, formatting and images survive, and nothing is published until you have seen the preview. Free on WordPress.org.
Download freeRelated Articles
How to Import Joplin Notes to WordPress
Joplin to WordPress: export your notes as Markdown and import them as posts with headings, lists, tables, code and images intact. One note free, a whole notebook with Pro.
How to Import a Notion Export into WordPress
Notion to WordPress via Markdown export: get pages into WordPress as posts with headings, lists, tables and images intact, one page free or a whole workspace with Pro.
How to Publish Obsidian Notes to WordPress
Obsidian to WordPress: your vault is already Markdown. Import notes as posts with headings, lists, tables and code intact, and get attachments into the right posts in bulk.
Import your first Word document in under 60 seconds
Start free. Import a Word document without copy-pasting or rebuilding its formatting. No account, no credit card. Straight from WordPress.org.