Skip to content
WordPress Guide

How to Embed a YouTube Video in WordPress

How to put a YouTube video on a WordPress page, keep it sized properly on phones, switch to privacy-enhanced mode, and why uploading the file is rarely better.

A bright home office desk with a laptop and a monitor
7 sections · 6 min read
In this article · 7 sections

You finally have a short video: a walk around the showroom, a two-minute explainer, a customer showing how the product fits. It is on your YouTube channel already. Now it needs to sit on the website, under the right heading, playing properly on phones.

To embed a YouTube video in WordPress you mostly just paste a link. What takes a little thought is everything around that paste: which address to use, how to keep the shape right on mobile, what privacy-enhanced mode is, and why uploading the video file itself to WordPress is rarely the better idea.

Check these first

  • The video’s visibility. Public and unlisted videos can be embedded. Private ones cannot; visitors will see an error.
  • Embedding is allowed. In YouTube Studio, a video’s advanced settings include an option to allow embedding. It is on by default, but worth checking if the video is someone else’s.
  • You have the right link. Open the video on YouTube and use Share to copy its address. A link copied from a playlist or search page can carry extra parts that confuse the embed.
  • Cookie banner. If your site uses a consent tool, it may block YouTube until a visitor accepts. That is normal behaviour, not a broken embed.

How to embed a YouTube video in WordPress, two ways

  1. Open the page in the block editor and click into an empty line where the video should go.
  2. Paste the YouTube address on its own, with no other words on that line.
  3. WordPress turns it into a YouTube embed block, and the video preview appears within a moment.
  4. Save or update the page and check it on the live site.

If the address stays as plain text or a link, there was probably something else on the line, or the link is not a normal video address. Undo, start a fresh empty block, and paste again.

The deliberate way: the YouTube block

  1. Click the + button and search for YouTube. It is one of the Embed blocks.
  2. Paste the video address into the box and click Embed.
  3. Use the block toolbar to set alignment (wide or full width if your theme supports it) and to add a caption.

Both routes create the same block. The second is handy when pasting keeps producing a link instead of a video.

On a site with the Classic Editor plugin, pasting the address on its own line in the Visual tab does the same job. In Elementor and similar builders, use the builder’s Video widget and paste the link into its settings.

Getting the size and shape right

Most YouTube videos are 16:9, the same widescreen shape as a television. The YouTube block keeps that shape as the page gets narrower, as long as the setting Resize for smaller devices in the block sidebar is on. Leave it on. Turned off, a video can keep a fixed height on phones and end up letterboxed or squashed.

  • Vertical videos filmed on a phone will show with wide black bars inside a 16:9 frame. For those, consider a narrower column, or accept the bars; on a phone the video will still be watchable once it plays full screen.
  • Full-width alignment looks dramatic on a computer but can make a video taller than the screen. Wide or normal width is usually more comfortable.
  • Two videos side by side fit neatly in a Columns block. On phones the columns stack, so each video becomes full width.

Privacy-enhanced mode

YouTube offers a second address for embeds, youtube-nocookie.com. In this privacy-enhanced mode, YouTube says it does not store information about visitors on your page unless they play the video. It is a sensible default for a business site, especially if you have visitors in the EU or UK.

The standard WordPress embed uses the normal youtube.com address. To use privacy-enhanced mode instead, you have two practical choices:

  1. A plugin. Several embed and privacy plugins switch YouTube embeds to the privacy-enhanced address, and some also add a click-to-load preview. Check the plugin’s description for that specific feature.
  2. Embed code by hand. On YouTube, click Share, then Embed, and copy the code. Change www.youtube.com in that code to www.youtube-nocookie.com, then paste it into a Custom HTML block. This works, but you lose the block’s automatic resizing unless your theme handles it, so check the result on a phone.

Privacy-enhanced mode reduces tracking; it does not, on its own, settle whether you need consent. If you run a cookie banner, check how it treats YouTube. Our guide to adding a cookie consent banner in WordPress explains how those tools hold back third-party content.

Why not just upload the video to WordPress?

You can add video to WordPress directly: the Video block accepts an MP4 upload and plays it with the browser’s own player. For a short silent clip, such as a few seconds of a product turning, that can be fine. For anything longer, a YouTube or Vimeo embed is usually the better choice, for practical reasons:

Uploaded to WordPress Embedded from YouTube
Storage and bandwidth Uses your hosting; large files fill it quickly Carried by YouTube
Upload limit Often too small for a full video Not your concern
Quality on slow connections One file, one quality Adjusts quality to the connection
What visitors see around it Only your video YouTube branding and suggested videos
Backups Videos make backups large and slow No effect

The real drawback of YouTube is in the fourth row: you have little control over what YouTube suggests when your video ends, which can include other channels. Many businesses accept that for the convenience. If a self-hosted or embedded video will not play, the causes are different, and our post on fixing a WordPress video that will not play covers both.

A note on page speed

A YouTube embed loads YouTube’s player and scripts as soon as the page opens, whether or not anyone presses play. One video on a page is rarely a problem. A page with several, or a video right at the top, can feel heavier on phones. Our post on whether YouTube embeds slow down a website explains the click-to-load approach that avoids most of that weight; this post stays with getting the video onto the page.

Videos sit alongside images, PDFs and galleries in WordPress’s media tools, which our guide to images and media on a WordPress site brings together. Settings, plugins, forms and the rest are covered in our guide to managing a WordPress website.

Frequently asked questions

Can I make a YouTube video autoplay on my WordPress page?

Not with the standard YouTube block, which has no autoplay setting. Custom embed code can ask for autoplay, but browsers generally only allow it when the video is muted, so it often does not behave as hoped. Autoplay also annoys many visitors and uses their mobile data, so a clear play button is usually the kinder choice.

Can I embed a whole YouTube playlist instead of one video?

Yes. Paste the playlist’s address from YouTube’s share option, and WordPress normally embeds a player that works through the list in order. Check it on the live page, because how the playlist appears depends on the link format. For a small business, one well-chosen video is usually more effective than a long playlist on a service page.

Does embedding my own YouTube video on my site count towards its views?

Plays of an embedded video are generally counted by YouTube in the same way as plays on YouTube itself, so embedding does not waste views. YouTube decides what counts as a view, and it does not publish the exact rules, so treat the number as a rough guide rather than a precise measure of website visitors.

Can I embed Vimeo or Facebook videos the same way?

Vimeo works the same way: paste the link on its own line or use the Vimeo embed block. Facebook and Instagram video embeds are less dependable, because those platforms changed how embedding works and WordPress no longer embeds them by simply pasting a link. A plugin or the platform’s own embed code is needed there.

If a video refuses to appear, shows the wrong size on phones, or your cookie tool is blocking it in ways you do not understand, that can be looked at as a single job through our WordPress bug fixing service (₹1,499 per incident onwards).

Next in this series: How to Replace an Image in WordPress (Same URL or New)

Is Your Website Working Properly?

Get a free website health check from WebMaintor. We'll review your website's speed, security, forms, and technical health — and tell you exactly what needs attention.

No obligation. No automated reports. A real review by our team.