How to embed a WordPress iFrame with and without a plugin

Tired of struggling to embed iFrames in your WordPress site? It’s a common hurdle that many face, especially when looking to integrate external content seamlessly. Whether it’s embedding a YouTube video, Google Map, or any other third-party content, mastering the art of embedding can elevate your website’s functionality and user experience.

WordPress, with its robust ecosystem, offers multiple ways to add iFrames—through plugins, shortcodes, or custom HTML blocks.

Yet, each method has its quirks and best practices, making it essential to choose the right one for your specific needs.

By diving into this article, you’ll discover how to embed a WordPress iFrame effectively, ensuring your content is not only interactive but also responsive and secure.

We’ll cover practical steps, all aimed at enhancing your site’s embedding capabilities.

Let’s get started and transform the way you integrate content on your WordPress site.

How to embed a WordPress iFrame: Quick Workflow

Embedding an iFrame in WordPress can be done using various methods, including plugins and manual HTML coding. Here are the steps for each method:

Method 1: Using a WordPress Plugin

  1. Install and Activate the Plugin: Install and activate the Advanced iFrame plugin from the WordPress dashboard.
  2. Configure the Plugin: Go to the Advanced iFrame plugin and select the Options tab. Adjust various configurations, including display and technical options.
  3. Check the URL: Use the plugin’s free iFrame checker to ensure the URL does not contain any scripts that will prevent the content from loading.
  4. Generate a Shortcode: In the Basic Settings tab, add the domain and define height, width, and transparency settings. Click Generate a shortcode for the current settings. Copy the shortcode.
  5. Embed the iFrame: Add the shortcode to a Shortcode block on any post or page via the block editor. Preview the page to ensure the iFrame works as intended.

Method 2: Using the Source’s Code

  1. Get the Embed Code: Locate the Share button beneath the content you want to embed (e.g., YouTube video). Select the Embed option to get the iFrame code.
  2. Add the Code: Open the block editor for the post or page where you want to embed the content. Click the + icon to add a new block and select Custom HTML. Paste the iFrame code.
  3. Customize Parameters: You can add parameters like width, height, and transparency to the iFrame code to customize its appearance.

Method 3: Manually Creating the iFrame Code

  1. Add an HTML Block: Open the page or post and add an HTML block in the WordPress content editor.
  2. Paste the Code: Paste the following code into your HTML block:
<iframe src="URL goes here"></iframe>

Replace URL goes here with the direct URL for the content you want to embed.

  1. Customize Parameters: You can add parameters like width, height, and transparency to the iFrame code to customize its appearance.

What is a WordPress iFrame?

By using a WordPress iFrame, you can embed a web page in the content of another one. This is done by using classic HTML tags that contain the external page link. Other specifications like how the Window appears can also be added in the custom HTML block.

This means that you can have a dynamic page on your site without hosting the content on the server. This saves a lot of space and makes your website move faster for your users.

At the same time, if you embed and not download, let’s say a video, the videos can appear on your site.

Users can watch the videos without any extra load on your serves. This is smart because the videos that are being streamed come directly from the source’s server.

You can use iFrames on almost any website or web page, and we are already starting to understand why. By using iFrames, many site owners create a medium that helps display the content or web pages from other sources. You can do all of this without being worried that you need any copyright permissions.

If you use iFrames, you can also show the content on your site without the need to host it in the WordPress Media Library.

Why is this important?

The answer is quite simple, all media files have taken up a significant amount of the storage space, and you could even slow your site down.

Why use a WordPress iFrame?

iFrame helps the website save storage and be faster. There are many users on the web to embed iFrame in WordPress without a plugin. This includes videos, images, other sites, and more. You can even use iFrame to save storage space by embedding content from other serves.

For sure, there are quite a few methods to embed content like using AJAX or HTML5 web elements or others. However, in many cases, iFrame is a better choice. For one, iFrame embedding is being used to cross-domain content. By doing so, a website user can ask the selected resources from a separate website and view it without manipulating the element.

Here are some advantages of using WordPress iFrame:

  • It lets you embed visual content for free
  • You can display multiple ads
  • It is a simple way to view content from external sources without any problems
  • It is secure, and you do not need to access the original content code

Embed iframes in WordPress with a plugin

WordPress iFrame plugins were made to use the HTML iFrame element that was deprecated on WordPress because of security reasons. This lets you customize the iFrame functionality with just some clicks. There is no need for any iFrame code anymore.

The plugins support shortcodes for inserting iFrame. They can be added in any section of the website like footer, widgets, and so on. The iFrame can showcase any other websites easily, and you can customize various attributes of it.

In this following, we are going to see the five best WordPress iFrame plugins:

iFrame

The iFrame plugin is going to offer great results. It has the same features as embedding an iFrame but is generated using a simple shortcode. Here is an example of how to use the shortcode for this WordPress plugin:

[iFrame src="https://www.YouTube.com/embed/fd0k_hbXWcQ" width="100%" height="400"]

Advanced Responsive Video Embedder

This plugin is excellent for those that embed YouTube or Vimeo videos on their WordPress website.

With the help of this plugin, you can bring videos in a responsive and straightforward format to your site.

This WordPress plugin also adds a Video Embed button in the WordPress text editor, and with its help, you can easily embed videos from different websites.

Advanced iFrame

Another useful plugin is the Advanced iFrame plugin. It uses shortcodes and not the regular iFrame attributes and provides a UI to create those shortcodes.

As WordPress removes iFrame tags for security purposes, this plugin is the best. You can begin by installing the plugin, and then you’ll see that using an iFrame gets easier.

Auto iFrame

This is a solution to embed iFrame on a WordPress website. Check it out and take advance of it.

iFrame popup

The iFrame popup WordPress plugin is developed to show a specific web page in a popup window. It uses the URL of the web page to be displayed. Besides that, it also uses the jQuery fancy box extension to reveal the iFrame in a popup.

How to embed iFrame in WordPress without a plugin

To do this, the steps are not complicated at all. All you need to do to embed code for an iFrame is open and close the HTML tags and the URL of the web page that you want to integrate.

An iFrame code looks like this:

<iFramesrc =”your_webpage_url”>

After that, if you want, you can bring more parameters to the tag. Defining the Window of the iFrame can be done using this:

  • Src – The source of the iFrame, this is a URL. If your site has SSL, you need to ensure all iFrames start with https://.
  • Width/Height– For height and Width of the iFrame Window, define values in Px
  • frame border – For displaying or hiding the Frameborder, use values ‘0’ or ‘1.’
  • Align – For determining the Window’s page alignment, Use values “left” “right” “right” “top,” “bottom.”
  • Scrolling – For disabling or enabling Scrolling inside the Window. Use values “yes,” “no” or

There are some limitations that we need to know about the source URL. If you use an iFrame, you can display just content from other sites that use the same Hypertext Transfer Protocols as yours.

So if your website starts with HTTPS, you can embed content from other third-party HTTPS sites. This also applies to sites that use HTTP; they can only embed URLs that contain HTTP.

FAQs about WordPress iframes

How do I embed an iFrame in WordPress?

To embed an iFrame in WordPress, simply use the Custom HTML block in the Gutenberg editor. Insert your iFrame code directly. For the Classic editor, switch to Text mode and paste your iFrame code. Ensure your code includes necessary parameters for responsive design and security.

Can I use a plugin to add an iFrame?

Absolutely! Plugins like WP iFrame or Advanced iFrame Pro can simplify the process. These plugins offer customizable options, allowing you to embed external content without diving into code. This is perfect for integrating media like YouTube videos or Google Maps seamlessly into your posts or pages.

How do I ensure my iFrame is responsive?

Making your iFrame responsive involves setting width and height to 100% and enclosing the iFrame in a div with relative positioning. Use CSS to adjust its dimensions based on the viewport. This ensures a smooth, user-friendly experience across all devices, enhancing both functionality and engagement.

Are there security concerns with embedding iFrames?

Yes, embedding iFrames can pose security risks. Use the sandbox attribute to restrict capabilities, and only embed content from trusted sources. Regularly update your WordPress and plugins to mitigate vulnerabilities. Security practices are crucial to maintaining the integrity of your site.

How do I embed a YouTube video in WordPress using an iFrame?

To embed a YouTube video, copy the iFrame code from the YouTube Share menu. In WordPress, paste it into the Custom HTML block or the Text editor. Ensure the code includes responsive parameters for optimal viewing on various devices. This method integrates YouTube content seamlessly.

Can I customize the appearance of my iFrame?

Yes, you can style your iFrame using CSS. Add custom CSS to your theme or use the Customizer to adjust aspects like borders, margins, and padding. This flexibility allows you to match the iFrame’s appearance to your site’s design, creating a cohesive user experience.

Why isn’t my iFrame showing up correctly?

If your iFrame isn’t displaying correctly, check for HTML errors or conflicts with other plugins. Ensure the URL is correct and accessible. Sometimes, content providers restrict embedding, requiring specific settings or permissions. Troubleshoot these areas to resolve display issues effectively.

How do I embed an iFrame in a WordPress widget?

To embed an iFrame in a widget, use a Text widget or the Custom HTML widget. Insert your iFrame code, ensuring it includes the necessary parameters for responsive design. This method allows you to add interactive content to your sidebar or footer effortlessly, enhancing site functionality.

Can I embed an iFrame in a WordPress page builder?

Yes, most page builders like Elementor and Divi support iFrames. Use the HTML widget or module to insert your iFrame code. These tools provide intuitive interfaces for embedding external content, allowing for greater customization and integration within your WordPress pages.

How do I embed an iFrame in WordPress without a plugin?

Embedding an iFrame without a plugin involves using the Custom HTML block in the Gutenberg editor or the Text mode in the Classic editor. Paste your iFrame code directly, ensuring it includes necessary parameters for responsive design and security. This method provides a straightforward approach to embedding content.

Conclusion

Mastering how to embed a WordPress iFrame can significantly enhance your website’s functionality, allowing seamless integration of external content like videos, maps, and forms. By understanding and applying the methods discussed—from using the Custom HTML block in Gutenberg to leveraging plugins and ensuring responsive design—you can embed content efficiently and securely.

Embrace the power of WordPress plugins like Advanced iFrame Pro for added customization and ease. Remember to always check for security measures, such as the sandbox attribute, to protect your site. Customize the appearance of your iFrames with CSS to match your site’s design, ensuring a cohesive user experience.

Ultimately, embedding iFrames correctly improves user engagement and interactivity, making your content richer and more dynamic. With these techniques at your disposal, you’re well-equipped to enhance your WordPress site’s capabilities, providing a robust, engaging experience for your visitors.

Leverage these insights, and transform the way you embed content on your WordPress site.

If you enjoyed reading this article on how to embed a WordPress iframe, you should check out this one about how to change fonts in WordPress.

We also wrote about a few related subjects like how to find the page ID in WordPress, how to download the WordPress media library, how to eliminate render-blocking JavaScript and CSS in above-the-fold content, how to stop a DDoS attack and how to hide page title in WordPress.


Bogdan Radusinovic
Bogdan Radusinovic

Senior SEO and Marketing Specialist

Articles: 137