WordPress

How to Embed a YouTube Video into WordPress Webpage

Paste a YouTube link to embed it in WordPress. Then fix the rest: player parameters, responsive sizing, click-to-load facades, nocookie mode and Error 153.

·12 min read
A video player placeholder with a play button and a click to load label, next to four steps for embedding YouTube in WordPress

To embed a YouTube video in a WordPress page, copy the video’s address from YouTube, paste it on its own line in the block editor, and WordPress turns it into a YouTube Embed block with a working player. No embed code or plugin is needed. If you want a start time, captions or privacy-enhanced mode, use YouTube’s iframe code in a Custom HTML block or a small filter instead, and on busy pages load the player only when someone clicks play.

That covers most people. The rest of this guide is the part that causes support tickets: links that stay as plain text, the Error 153 message that appeared on many sites in late 2025, player settings that no longer work, slow pages, and cookie consent in the EU. Our team checked every detail on 18 November 2026 against WordPress 7.1.4 core source, the Gutenberg repository and Google’s YouTube developer documentation.

What is the quickest way to embed a YouTube video in WordPress?

Paste the link. WordPress has supported YouTube through oEmbed since version 2.9, which means it asks YouTube for the player code itself and stores the answer. You never touch HTML.

  1. Open the video on YouTube and copy the address from the browser bar, or click Share and copy the short youtu.be link.
  2. In the WordPress editor, click where the video should go and paste the link on an empty line.
  3. The editor converts it into an Embed block with a live preview. If it does not, add a block, search for YouTube, and paste the link into its field.
  4. Optional: add a caption under the video. Captions help readers and give search engines context.
  5. Save or update the page and check it on the front end.

On the classic editor, paste the link on its own line in the Visual tab, with nothing else on that line. The same oEmbed process runs when the page is displayed. The older [embed] shortcode also still works, but you rarely need it.

Which YouTube links does WordPress recognise?

WordPress keeps a list of trusted oEmbed providers in class-wp-oembed.php. In WordPress 7.1.4 the YouTube entries match these address formats:

Link format

Example

Embeds as

Watch page

youtube.com/watch?v=ID

Single video

Short link

youtu.be/ID

Single video

Playlist

youtube.com/playlist?list=ID

Playlist player

Shorts

youtube.com/shorts/ID

Single video

Live

youtube.com/live/ID

Live stream or replay

Channel pages, search results and links with extra tracking wrappers (from email tools, for example) are not on the list. Paste the plain watch link instead.

How do I embed a YouTube video with the iframe code instead?

Use the iframe when you need player options that a plain link cannot carry, such as a start time on a playlist, captions switched on by default, or the privacy-enhanced domain. On YouTube, click Share, then Embed, and copy the code. In WordPress, add a Custom HTML block and paste it.

Here is a clean version you can adapt. Replace VIDEO_ID with the 11-character ID from the link:

<!-- Checked on 18 November 2026 against Google's YouTube embed documentation -->
<iframe
	width="560"
	height="315"
	src="https://www.youtube-nocookie.com/embed/VIDEO_ID?start=90&cc_load_policy=1"
	title="What the video is about, in plain words"
	loading="lazy"
	allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share"
	referrerpolicy="strict-origin-when-cross-origin"
	allowfullscreen></iframe>

Three attributes in that code matter more than they look.

  • title gives screen reader users a name for the frame. WordPress adds one automatically to oEmbed iframes, but hand-pasted code needs its own.
  • loading=”lazy” tells the browser not to load the player until the reader scrolls near it.
  • referrerpolicy makes sure YouTube receives your site’s address. Google’s Required Minimum Functionality page says embedded players “must provide identification through the HTTP Referer request header” and recommends exactly this policy. Leave it out on a site that strips referrers and the player fails with Error 153, covered further down.

One trade-off: Custom HTML blocks do not get the automatic responsive sizing that the Embed block has, so you also need the CSS from the responsive section below.

How do I start a video at a set time, loop it or hide related videos?

Add player parameters to the end of the /embed/ address, after a question mark, joined with ampersands. Several popular parameters changed or stopped working in recent years, so here is the current list from Google’s player parameters reference, checked on 18 November 2026:

What you want

Parameter

Notes

Start at 1:30

start=90

Seconds; the player may jump to a keyframe up to about two seconds earlier

Stop at 3:00

end=180

Counted from the start of the video

Captions on

cc_load_policy=1

Add cc_lang_pref=fr for a language

Hide controls

controls=0

Readers lose pause and volume, use with care

Loop one video

loop=1&playlist=VIDEO_ID

Loop only works with the playlist parameter set to the same ID

Play inline on iPhone

playsinline=1

Default 0 opens fullscreen on iOS

Autoplay

autoplay=1

Browsers block autoplay with sound, see below

Fewer related videos

rel=0

Shows related videos from the same channel only; it cannot switch them off

Two parameters you will still see in old tutorials no longer do anything. modestbranding was deprecated on 15 August 2023 and has no effect, and showinfo was removed back in 2018. Since September 2018, rel=0 limits related videos to the same channel rather than hiding them, so there is no way to show zero suggestions in the standard player.

Autoplay deserves its own warning. Chrome’s autoplay policy says “Muted autoplay is always allowed”, while autoplay with sound needs the visitor to have interacted with your site first. So autoplay=1 on its own usually just shows a paused player. Google’s parameter list has no mute option; the documented route is the IFrame Player API, where you set enablejsapi=1 and call mute() before playing. A mute=1 address parameter is widely copied but undocumented, so test it before relying on it. Then ask whether readers want a video that starts on its own at all.

How do I make an embedded YouTube video responsive?

With the Embed block, it usually already is. The block measures the iframe YouTube sends back, works out its aspect ratio and adds classes such as wp-embed-aspect-16-9 and wp-has-aspect-ratio to the block. Core CSS then keeps the video at 16:9 at any width, but only when the page’s body has the wp-embed-responsive class.

That body class comes from theme support. Every block theme gets it automatically: WordPress has added responsive-embeds support to block themes since version 5.9. A classic theme has to opt in. If your videos look tiny or have black bars on phones, add this line to the classic theme’s functions.php (a child theme is safer):

<?php
// Checked on 18 November 2026 with WordPress 7.1.4.
add_action(
	'after_setup_theme',
	function () {
		add_theme_support( 'responsive-embeds' );
	}
);

In the block sidebar, under Media settings, the Resize for smaller devices toggle controls this per video. Leave it on unless a specific embed needs a fixed size.

For an iframe in a Custom HTML block, the modern fix is one CSS property. Give the iframe a class such as yt-frame and add:

/* Checked on 18 November 2026 */
.yt-frame {
	width: 100%;
	height: auto;
	aspect-ratio: 16 / 9;
}

Videos are not the only content that can push a phone layout wider than the screen. Wide tables do it too, and our guide to making a responsive table in WordPress covers the same problem for data.

Does an embedded YouTube video slow down a WordPress page?

Yes, if it loads before anyone needs it. A YouTube iframe pulls in the player’s own scripts, styles and images from Google’s servers, and it does that for every video on the page. Google’s own Lighthouse tool flags this under Lazy load third-party resources with facades.

WordPress helps a little on its own. Since version 5.7, core adds loading="lazy" to iframes in post content that have a width and height, and oEmbed iframes qualify because embeds are processed before that filter runs. Core skips lazy loading for the first few media elements it thinks sit above the fold (the wp_omit_loading_attr_threshold filter, default 3), so a video at the very top of a post still loads straight away. That is usually right for a hero video, and wrong for a video in a footer.

Facades: load the player only on click

A facade shows a lightweight preview image with a play button, and swaps in the real player when someone clicks. Nothing from the YouTube player loads until then. The best-known option is Paul Irish’s lite-youtube-embed, whose README claims it renders about 224 times faster than a normal embed. You load its CSS and JS once, then use a custom element:

<!-- Checked on 18 November 2026 against the lite-youtube-embed README -->
<lite-youtube videoid="VIDEO_ID" playlabel="Play: What the video is about"></lite-youtube>

Its README notes that the default embed uses youtube-nocookie.com, and that the preview image comes from YouTube’s image server. On iPhone and iPad Safari it prepares the real player ahead of time so one tap plays with sound, which trades away some of the speed and privacy benefit on those devices.

If you would rather not touch code, the WP YouTube Lyte plugin does the same job for normal Embed blocks. On 18 November 2026 the WordPress.org plugin API listed version 1.7.32, last updated 20 August 2026, 20,000+ active installs, a 96 percent rating from 206 reviews, and testing up to WordPress 7.1.4. Many caching and performance plugins also offer a “replace YouTube iframe with preview image” setting, so check yours before adding another plugin.

Facades are one part of a faster page. Our guide to removing render-blocking CSS and JS covers the scripts that load before the video does.

What is YouTube privacy-enhanced mode?

It is the same player served from www.youtube-nocookie.com instead of www.youtube.com. Google’s embed help page says views in this mode “will not be used to personalize the YouTube browsing experience” and will not personalise advertising shown to the viewer outside your site. Ads can still appear, but they are non-personalised.

What it does not mean is zero storage. Developer Stefan Judis found YouTube writing to localStorage from a nocookie embed and summed it up as “youtube-nocookie.com does not mean no cookies” (post from April 2023). Treat it as a reduction, not a consent exemption.

Switch every embed to privacy-enhanced mode

The Embed block has no setting for this, because it uses whatever player code YouTube sends. This filter rewrites the player address on every YouTube oEmbed and adds the referrer policy if an older cached embed lacks it. Put it in a small plugin or your child theme:

<?php
/**
 * Serve YouTube oEmbeds from the privacy-enhanced domain and make sure
 * the iframe sends a referrer YouTube accepts.
 * Checked on 18 November 2026 with WordPress 7.1.4 and PHP 8.5.
 */
add_filter(
	'embed_oembed_html',
	function ( $html, $url ) {
		if ( ! str_contains( $html, 'youtube.com/embed/' ) ) {
			return $html;
		}

		$html = str_replace(
			'https://www.youtube.com/embed/',
			'https://www.youtube-nocookie.com/embed/',
			$html
		);

		$tags = new WP_HTML_Tag_Processor( $html );
		if ( $tags->next_tag( 'iframe' ) && null === $tags->get_attribute( 'referrerpolicy' ) ) {
			$tags->set_attribute( 'referrerpolicy', 'strict-origin-when-cross-origin' );
		}

		return $tags->get_updated_html();
	},
	10,
	2
);

We tested it against the WordPress 7.1.4 HTML API with the exact markup YouTube’s oEmbed endpoint returned on 18 November 2026, which already includes referrerpolicy="strict-origin-when-cross-origin", and with an older-style iframe without it. Both came out on the nocookie domain with the policy set, and non-YouTube embeds passed through untouched. The embed_oembed_html filter runs on cached results too, so existing posts change without re-saving.

Do I need cookie consent to embed YouTube videos under GDPR?

For visitors in the EU and UK, assume yes, unless the player loads only after the visitor asks for it. We are not lawyers, and the exact rules depend on your country’s regulator, so treat this as the technical side of the question.

The rule that matters most is Article 5(3) of the ePrivacy Directive, which requires consent before storing or reading information on a visitor’s device, unless it is strictly necessary for a service the visitor asked for. The European Data Protection Board’s Guidelines 2/2023, adopted in final form on 7 October 2024, state that it “does not exclusively apply to cookies, but also to ‘similar technologies’”. A YouTube player that writes to browser storage on page load would fall in that scope, nocookie domain or not. GDPR adds its own questions, because the visitor’s IP address reaches Google as soon as anything loads from its servers.

A consent-friendly setup looks like this:

  1. Show a placeholder instead of the player: a local preview image you host yourself, the video title, and a short note such as “Playing this video loads content from YouTube”.
  2. Load the real player only after a click, or after the visitor accepts the “media” or “marketing” category in your consent tool.
  3. Use the privacy-enhanced domain for the player itself.
  4. List YouTube in your privacy policy and cookie notice.

Most consent management plugins can block iframes until consent and show a placeholder, so check yours before writing code. Also watch the caching side effect: consent tools set cookies, and some cookie names make page caches skip the cache entirely. Our post on cookies that quietly bypass the WordPress page cache shows how to check.

Why does my YouTube embed show only a link?

Because the oEmbed lookup failed and WordPress cached the failure. When WordPress first displays an embed, it asks YouTube for the player code and saves the answer in the post’s meta, under keys that start with _oembed_. If that request fails, because YouTube rate-limited your server, a firewall blocked the outgoing request, or the video was private at the time, core stores the value {{unknown}} and prints the plain link. You can see this logic in WP_Embed::shortcode() in core’s class-wp-embed.php.

The fix is to clear that cached result so WordPress asks again. With WP-CLI:

# Checked on 18 November 2026 with WP-CLI's embed command.
# Clear the cached oEmbed results for one post, then load the post again.
wp embed cache clear 123

# Ask WordPress what it gets for a URL right now, skipping the cache.
wp embed fetch "https://www.youtube.com/watch?v=VIDEO_ID" --skip-cache

If wp embed fetch returns nothing, the problem is the connection between your server and YouTube, not the post. Without WP-CLI, editing the post and re-adding the Embed block usually forces a fresh lookup too. While you are looking at oEmbed, note that WordPress also publishes its own oEmbed endpoint for your posts, and it can reveal author names; our guide to every way WordPress hands out usernames explains that side.

What does YouTube Error 153 mean on a WordPress site?

It means YouTube did not receive a usable referrer. Google’s IFrame API reference defines error 153 as: “The request does not include the HTTP Referer header or equivalent API Client identification.” The player shows “Error 153, Video player configuration error” instead of the video.

On WordPress sites the usual cause is a Referrer-Policy header set to no-referrer or same-origin by a security plugin, the host, a CDN rule or an .htaccess line. Simon Willison traced the same error on his own site to a framework default that sent same-origin, and fixed it with strict-origin-when-cross-origin (December 2025). To fix it:

  1. Open the page, then your browser’s developer tools, and check the response headers for Referrer-Policy.
  2. If it says no-referrer or same-origin, change it to strict-origin-when-cross-origin in the plugin, host panel or server config that sets it.
  3. If you cannot change the header, make sure each iframe carries referrerpolicy="strict-origin-when-cross-origin". The filter above does that for oEmbeds, and an iframe attribute takes priority over the page policy for that request.
  4. Clear page and CDN caches, then reload.

Common mistakes people report

These come up again and again in WordPress support threads and the core bug tracker. Each one links to the original report, with its date. Checked on 18 November 2026.

  • Error 153 after a browser or header change. A WP YouTube Lyte support thread from November 2025 asked for a fix for the new 153 error, and a WordPress core ticket, #64395 from December 2025, reports the YouTube Embed block failing with Error 153 in Safari 26.1 while Chrome and Firefox worked. Check the referrer policy first.
  • Embeds turning into plain links. In an August 2020 thread, a site owner’s YouTube embeds suddenly showed only the URL, and other users reported the same. A similar June 2020 thread described videos randomly replaced by the address. Both match a failed oEmbed lookup cached as unknown; clear the embed cache.
  • Video fine in the editor, missing on the post. A user’s YouTube block looked right in the editor but only the caption appeared on the live post (February 2019 thread). That pattern usually points to a theme or plugin filtering post content, so test with a default theme.
  • Believing nocookie means no consent. A Ghost forum how-to and the Judis post above both found YouTube storage on the nocookie domain. Pair it with a click-to-load facade if you need consent before loading.
  • Using dead parameters. modestbranding=1, showinfo=0 and rel=0 are still copied from old guides. The first two do nothing now, and the third only limits suggestions to your channel, per Google’s parameter reference.

Frequently asked questions

Can I embed a YouTube video without a plugin?

Yes. Pasting the link into the block editor uses WordPress’s built-in oEmbed support. Plugins only help with extras such as click-to-load facades, galleries or consent blocking.

Does embedding a YouTube video help SEO?

It can help readers, which helps the page. The video itself is indexed by Google as YouTube’s content, so write a real description, a transcript or summary, and a caption around it. A page that is only a video gives search engines and AI tools little to work with.

Can I embed a private or unlisted video?

Unlisted videos embed normally. Private videos do not play for visitors, and YouTube returns error 100 or a “video unavailable” message. If the uploader switched off Allow embedding in YouTube Studio, you get error 101 or 150.

How do I embed a YouTube Shorts video?

Paste the youtube.com/shorts/ID link on its own line. WordPress 7.1.4 recognises that format. The player is the standard one, so check how the vertical video looks inside your content column.

Should I upload videos to the Media Library instead?

Only for short clips. Self-hosted video uses your server’s bandwidth and storage and gets no adaptive streaming. If you want a looping background clip rather than a player, our guide to adding a video background in WordPress with HTML covers that case.

Why does the video not autoplay?

Browsers block autoplay with sound until the visitor has interacted with your site. Muted autoplay is allowed, which needs the IFrame Player API, or simply let the visitor press play.

A quick checklist

  1. Paste the plain watch, youtu.be, Shorts or playlist link on its own line.
  2. Add a caption and a written summary around the video.
  3. Classic theme? Add responsive-embeds theme support.
  4. Below the fold or several videos? Use a click-to-load facade.
  5. EU or UK visitors? Load the player only after consent, on the nocookie domain.
  6. Seeing Error 153? Check the Referrer-Policy header.
  7. Plain link instead of a player? Run wp embed cache clear for the post.

Part of the Wbcom Designs family

The all-in-one WordPress community stack

Also ours: wbcomdesigns.comvapvarun.combrndle.com