How to Embed YouTube Videos in WordPress (3 Easy Ways)
To embed YouTube video in WordPress, simply paste the video's direct URL onto a blank line in the Gutenberg editor, and WordPress will convert it into a responsive player automatically. Alternatively, you can use the built-in YouTube block or insert custom iframe code via a Custom HTML block for granular playback controls.
Adding video content to your site increases dwell time, improves search visibility, and keeps readers engaged without bogging down your web hosting server with heavy media files. Below, we break down all three methods step-by-step so you can choose the approach that best fits your workflow.

Method 1: The Instant URL Paste (Automatic Embed)
WordPress features native oEmbed support. This means WordPress recognizes links from approved providers like YouTube and renders them into an interactive player without requiring any external plugins.
Step-by-Step Instructions:
- Open YouTube in your browser and locate the video you want to share.
- Copy the video's full URL from the browser address bar (e.g.,
https://www.youtube.com/watch?v=dQw4w9WgXcQ) or click Share below the video and copy the shortened link (https://youtu.be/...). - Open your WordPress admin dashboard and navigate to the post or page you want to edit.
- Click inside the Gutenberg block editor where you want the player to appear.
- Paste the URL directly into an empty Paragraph block.
- WordPress will immediately transform the plain link into an embedded YouTube player.
Note for Classic Editor users: If you still use the Classic Editor plugin, paste the raw URL on its own line without adding formatting or hyperlinks. The editor will automatically handle the player conversion on the live site.
Method 2: The Native YouTube Block
If you prefer structured layout controls within the block editor, the native YouTube block provides dedicated alignment and aspect ratio settings.
Step-by-Step Instructions:
- Open your target post or page in the WordPress editor.
- Click the + (Add block) button in the upper-left corner or directly within the editor canvas.
- Type
YouTubeinto the search field and select the red YouTube icon. - Paste your video URL into the input field that appears inside the block.
- Click the Embed button.
Customizing the Native Block
Once embedded, the block toolbar and the right-hand settings sidebar offer convenient controls:
- Alignment: Choose left, center, right, wide width, or full width (depending on whether your active WordPress theme supports wide alignments).
- Aspect Ratio Maintenance: In the right sidebar under Block Settings, toggle Resize for smaller devices to ensure the player maintains its 16:9 ratio across smartphones and tablets.
If you want the video to jump straight to a key highlight rather than starting at zero, you can configure the link beforehand. Check our guide on how to start a YouTube video at a specific time to learn how to append precise time offsets before pasting.
Method 3: Embed YouTube Video WordPress with Custom HTML (iFrames)
While automatic embeds are convenient, they provide zero control over player behavior. If you want to disable related videos from other channels, turn on autoplay, mute the audio on load, or implement strict cookie controls, you need an HTML <iframe>.
Step-by-Step Instructions:
- On YouTube, navigate to your video and click the Share button below the title.
- Select Embed from the sharing options.
- Copy the generated iframe snippet.
- Return to your WordPress editor, click the + button, and search for the Custom HTML block.
- Paste the iframe code directly into the block.
- Click Preview on the block toolbar to verify that the video displays correctly.
Using Advanced Iframe Parameters
By tweaking the src URL inside your iframe code, you gain full control over the viewing experience. Here are the most useful URL parameters:
| Parameter | Value | What It Does |
|---|---|---|
autoplay=1&mute=1 | 1 | Plays the video automatically on load (browsers require mute=1 for autoplay). |
controls=0 | 0 | Hides player controls (play button, volume slider, progress bar). |
start=X | Seconds | Starts the video at second X. |
end=Y | Seconds | Stops the video automatically at second Y. |
rel=0 | 0 | Shows related videos only from your channel, not competitors. |
Here is a complete custom iframe code example featuring muted autoplay and no related third-party videos:
<iframe
width="560"
height="315"
src="https://www.youtube-nocookie.com/embed/dQw4w9WgXcQ?autoplay=1&mute=1&rel=0"
title="YouTube video player"
frameborder="0"
allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share"
referrerpolicy="strict-origin-when-cross-origin"
allowfullscreen>
</iframe>To build complex configurations without writing code manually, you can use our free YouTube Embed Code Generator to toggle controls, dimensions, loops, and security headers instantly.
Making Your Custom Embeds Responsive
Standard iframe embeds include fixed pixel widths and heights (such as width="560" height="315"). On mobile screens, fixed dimensions can overflow the screen edge and break your theme layout.
To prevent this, wrap your iframe code inside a responsive CSS container. For a detailed breakdown of modern CSS aspect-ratio properties, read our tutorial on how to make a YouTube embed responsive on mobile.
Here is the modern CSS approach you can paste inside a Custom HTML block:
<div style="position: relative; width: 100%; aspect-ratio: 16 / 9;">
<iframe
src="https://www.youtube.com/embed/dQw4w9WgXcQ"
title="Responsive YouTube video"
style="position: absolute; top: 0; left: 0; width: 100%; height: 100%; border: 0;"
allowfullscreen>
</iframe>
</div>Because this snippet uses modern inline CSS, it adapts dynamically to any screen width from desktop monitors to phones without altering your theme stylesheet.
Privacy & GDPR Considerations (youtube-nocookie)
Standard YouTube embeds drop tracking cookies on your visitors' devices the moment your WordPress page loads—even before they click play. In regions governed by GDPR, CCPA, or strict ePrivacy laws, this can trigger compliance violations unless you have explicit user consent.
To mitigate this issue, switch your embed domain to YouTube's privacy-enhanced domain:
- Standard domain:
https://www.youtube.com/embed/VIDEO_ID - Privacy-enhanced domain:
https://www.youtube-nocookie.com/embed/VIDEO_ID
The privacy-enhanced mode prevents YouTube from storing personal cookies until the visitor actually presses the play button. For a full breakdown of cookie behavior and consent notices, review our YouTube-nocookie Embeds and GDPR: Complete Guide.
Summary of Methods
- Auto-Embed (Paste URL): Best for quick blog posts when standard controls and default sizes are sufficient.
- Native YouTube Block: Best when you need theme-based visual alignment (wide or full-width styling).
- Custom HTML Block: Best for creators and businesses needing custom start times, loop parameters, privacy enhancements, or muted autoplay.
Frequently asked questions
Why is my YouTube embed not showing in WordPress?
Make sure the video URL is placed on its own line without any hyperlinking or bold text. If using an iframe inside a Custom HTML block, ensure you did not accidentally paste it into a standard Paragraph block.
Does embedding YouTube videos slow down my WordPress site?
Embedded videos do load external scripts from Google's servers, which can add extra network requests. You can offset this by using privacy-enhanced mode (youtube-nocookie) or caching plugins that lazy-load iframes until a user scrolls down.
Can I embed a YouTube Short the same way in WordPress?
Yes. Pasting a Shorts link into the WordPress editor will embed the player, though it often renders in a standard 16:9 widescreen frame unless adjusted via custom iframe dimensions.
Do views on an embedded WordPress video count toward my YouTube view count?
Yes, plays from embedded videos generally count toward your total YouTube views, provided the playback is initiated by a real user interaction and complies with YouTube's playback policies.


