If you want to embed content, such as videos, maps, content from other websites, PDF files, or other media, directly into your WordPress posts or pages, you’ve come to the right place.
Iframe is one of the most effective ways to do this.
In this comprehensive guide, you will learn how to add an iframe in WordPress step-by-step, quickly and easily, ensuring that you manage your WordPress site’s content like a pro.
Embedding iframes in WordPress may sound complicated at first, especially if you’re new to website management. However, it is a straightforward task that can improve your site’s functionality and user experience. Let’s dive in and get started!
What is an iFrame, and Why Use It?
An iframe (inline frame) is an HTML element that allows you to embed another HTML page inside your current page. It’s a window on your website that can display content from another source, such as videos, interactive maps, or external web pages.
Some common uses of iframes include:
- Embedding YouTube or Vimeo videos
- Displaying Google Maps locations
- Embedding forms or surveys from other platforms
- Showing social media feeds or widgets
- Presenting PDF document files
With iframes, you can provide your visitors with dynamic content and third-party services without requiring them to leave your site.
Step-by-Step Guide to Adding an Iframe in WordPress
Let’s explore how to embed an iframe within a WordPress post or page in a simple manner, regardless of your technical background.
Step 1: Accessing Your WordPress Dashboard
You can start by logging into your WordPress admin dashboard. The dashboard is the control center for managing all WordPress-related tasks, including posts, pages, settings, and plugins.
Once logged in, you can navigate to Posts or Pages, depending on where you want to add the iframe.
Step 2: Choosing the Post or Page to Edit
Hover over either Posts or Pages in the left menu, depending on where you want to add the iframe. For this tutorial, we’ll select Pages.
Next, click the “Edit” link below the post you want to edit.

Step 3: Adding a Custom HTML Block
Scroll down to where you’d like to embed your iframe content. It could be anywhere within your post body.
Click the plus icon (+) to add a new block. In the search field, type Custom HTML and click on it to add it to your desired location.
Select the Custom HTML block from the results.

Step 4: Understanding the iframe HTML Code
Inside the Custom HTML block, you will paste your iframe code. An iframe HTML tag looks like this:
<iframe src="codehere" width="100%" height="315" frameborder="0" allowfullscreen></iframe>
The src attribute contains the URL of the content you want to embed. The width and height define the size of the iframe on your page. The frameborder attribute controls whether the iframe has a border and allowfullscreen lets users view embedded videos in fullscreen mode.

Where you see code here in the example, this is where you will insert your actual iframe code.
Step 5: Getting the iframe Code from YouTube (Example)
In this example, we will embed a YouTube video using an iframe. First, navigate to the YouTube video you want to embed.
Below the video, click the Share icon.

In the share options, click Embed to display the iframe embed code you need.

Copy the iframe code to your clipboard.

Step 6: Pasting the iframe Code into WordPress
Return to your WordPress post editor, where the Custom HTML block is active.
Paste the iframe code you copied from the last step.

Step 7: Previewing Your iFrame Embed
WordPress allows you to preview how the iframe will appear on your post before publishing or updating.
Click the Preview tab in the Custom HTML block to view the embedded content.
To switch back to the code view, click the HTML tab again.

Step 8: Saving Your Changes
Once satisfied with how your iframe looks, it’s time to save your changes. Click the Update button to save the post or page with the embedded iframe.
Step 9: Viewing the Embedded iframe on Your Site
Once saved, visit the page to ensure it’s working as expected.
Scroll down to the section where you added the iframe. You should see the embedded YouTube video or other content displayed exactly as expected.
Additional Tips for Using iFrames in WordPress
While adding iframes is a simple process, here are some essential tips to keep in mind before embedding it:
- Responsive Design: By default, iframes have fixed widths and heights. To make iframes responsive (resize automatically on different devices), you may need to add custom CSS or use plugins that handle responsive breakpoints.
- Security Concerns: Embedding content from trusted sources is crucial. Do not embed iframes from unknown or suspicious sites to prevent security risks.
- Using Plugins: If you frequently embed iframes or want more customization options, consider WordPress plugins designed for easy and secure content embedding. Embed PDF Viewer is a reliable plugin for embedding PDFs in WordPress.
- Performance: Prevent multiple iframes from loading on the same page, as it can slow down your site. Optimize your content and only embed iframes when necessary.
Everyday Use Cases for iFrame Embeds in WordPress
Here are some practical examples of where iframes can come in handy in WordPress:
Embedding Videos
Embedding videos from YouTube, Vimeo, or other platforms is one of the most common uses of the < iframe> element. It allows you to showcase multimedia content without hosting the video files yourself, saving bandwidth and storage space.
Displaying Maps
Integrate Google Maps or other interactive maps to show your business location, event venues, or travel routes. This enhances user experience by providing easy-to-use navigation directly on your site.
Embedding External Forms
Use iframes to display forms from third-party services, such as Google Forms, Typeform, or other survey tools. This helps you collect data without the need for complex integrations or external plugins.
Showcasing Social Media Widgets
Embed Twitter feeds, Instagram galleries, or Facebook posts to keep your site dynamic and connected with your social media presence.
Why Choose the Custom HTML Block for iframe Embeds?
WordPress’s block editor (Gutenberg) offers multiple block types. The Custom HTML block is ideal for iframe embeds because:
- It allows you to insert raw HTML code directly without filtering.
- It provides a live preview, allowing you to see how your embedded content will appear.
- It’s flexible and works for both posts and pages.
While some blocks like Video, YouTube, or Embed exist for specific platforms, using Custom HTML gives you complete control over the iframe’s attributes and source.
Troubleshooting iframe Embeds in WordPress
If you encounter issues when embedding iframes, consider these common troubleshooting steps:
- Iframe Not Showing: Some websites restrict embedding their content via iframes using security headers like
X-Frame-Options. In such cases, you cannot embed their content. - Content Not Loading: Check the iframe URL for correctness and ensure you copied the full embed code.
- Editor Strips iFrame Code: Some WordPress configurations or security plugins may strip iFrame tags. Verify your user role and plugin settings.
- Unmatched HTTP protocol: If you embed an iframe into your WordPress website but can’t see it being displayed on the screen, please ensure both sources have the same HTTP protocol. For example, if the link inside the
srccode contains HTTPS, you’ll need to install an SSL certificate on your WordPress website. - Responsive Issues: If the iframe is too large or too small on different devices, consider adding CSS to make it responsive or use plugins that handle responsive embeds.
Conclusion
Adding an iframe in WordPress is a quick and easy way to enrich your website with content from external sources.
Whether embedding a YouTube video, a document, or any interactive media, the process involves just a few simple steps using the WordPress Custom HTML block.
By following this step-by-step guide, you can add iframes to your posts or pages to enhance engagement without requiring complex coding knowledge.
Always ensure that the sources you embed are trustworthy, and preview your content before publishing. Embedding iframes is a must-know tool that will help you continue to grow and customize your WordPress site.
Please leave a comment and let us know what content you embedded with an iFrame on your WordPress website.