Black Friday50% off every Pro template and membership with code50% off with Ends in 05days15hrs54min30secShop the sale →

How to Add iFrame Code to WordPress

What Is an iFrame and Why Use It? As you know, an iFrame allows you to add videos or any other content to your site without hosting the content. That means the actual content is loaded from the source. If…

How to Add iFrame Code to WordPress

What Is an iFrame and Why Use It?

As you know, an iFrame allows you to add videos or any other content to your site without hosting the content. That means the actual content is loaded from the source.

If you use an iFrame to embed any content you want into your site, you can save storage space and bandwidth. Besides that, using an iFrame is the best way to avoid copying other content on the Internet. Moreover, whenever the original content changes, it will be updated in the iFrame automatically. So, the content on your site won’t be outdated. For more information, you can read why you should embed videos in WordPress here.

Nowadays, many big platforms such as YouTube provide you with the iframe code to embed on your site. However, if you want to use the content from smaller websites that don’t offer iFrame code, today’s blog will help you solve the issue. Now, let’s explore 3 ways to add iFrame Code to WordPress!

Methods to Add iFrame Code to WordPress

Utilizing the Source’s Embed Code

Nowadays, many big websites provide embed code for their content. All you need to do is copy and paste the code into your site. For example, if you want to add the iFrame code of a video on YouTube, let’s follow the steps below.

First of all, you need to click on the Share button under the video you want to add to your site.

add iframe code to wordpress 1

After that, a share popup will appear for you to select the share options. Simply click the Embed button.

add iframe code to wordpress 2

YouTube will give you the iFrame code. Then, you can decide whether to show player controls and enable privacy-enhanced mode. We suggest turning on both options.

In the next step, you just need to click on the Copy button to get the iFrame code.

add iframe code to wordpress 3

Now, let’s go back to the admin dashboard. You can add the code to any post or page you want.

In our example, we will embed the code on a new page. So, go to Page -> Add new.

If you are using the block editor, click the plus icon to add a new block. After that, simply search for HTML block.

add iframe code to wordpress 4

Next, all you need to do is paste the iFrame code you copied before into the block. Don’t forget to Publish/ Update your page to save your changes.

add iframe code to wordpress 5

If you choose to use the Classic editor – one of the most popular WordPress Editor Plugins instead of the default editor, simply go to the Text box to add the code.

Of course, you need to Publish/Update the content you have just added.

add iframe code to wordpress 6

Now, let’s visit the front-end page to see the result here.

add iframe code to wordpress 7

Using a Plugin

If you want to add content from any source without worrying that the source doesn’t provide embed code, then you can use a plugin to do that.

First of all, let’s install and activate iFrame, which is one of the most useful WordPress iFrame Plugins. You can follow some simple steps to install a WordPress plugin here.

add iframe code to wordpress 8

After activating, the plugin works without any setup. So, create a new post/page or edit an existing one.

If you use the Classic Editor, simply switch to the Text box and add the shortcode below. On the other hand, if you use the block editor, let’s add a new block and search for a shortcode block. Then, add the following shortcode:

[iframe src="URL example"]

Replace the example URL with the URL of the content you wish to add to your site. For instance, we would like to add a song from SoundCloud, so we will get the link from the content and add it to the shortcode. Let’s see the example in the image below.

Don’t forget to save your content by clicking on the Publish/Update button.

add iframe code to wordpress 9

Next, let’s check the result on your site now!

add iframe code to wordpress 10

Generating the iFrame Code to Add Content Manually

Besides the two ways above, you can also add iFrame code to WordPress manually. All you need to do is insert the following code into any post or page you want:

<iframe src="URL example"></iframe>

Replace the example URL with the URL of the content you need to add to your post/page.

For the block editor, select the HTML block and paste the code. For the Classic editor, simply go to the Text tab and add the code. After that, don’t forget to Update/Publish the post or page. That’s it.

In case you want to edit the width or height of the iFrame, you just need to add the code below:

<iframe src="URL goes here" width="600" height="300"></iframe>

You can alter the width and the height as you want.

add iframe code to wordpress 11

Finally, let’s see what we have on the site.

add iframe code to wordpress 12

Final Thoughts

In conclusion, we hope that today’s blog helps you add iFrame code to WordPress effectively. Do you have any questions to ask us? Don’t hesitate to leave your comment below, so we can answer you as soon as possible. If you found the blog useful, please share it with your friends. Last but not least, don’t forget to visit our responsive and attractive Free WordPress Themes here.

Build it with a template

Start from a finished design: Joomla templates, WordPress themes or the AI-ready block themes. Every template has a free version and a live demo.

Stuck on a template?

Pro customers can open a ticket; everyone can read the documentation.

Free download

We'll send the link, setup tips and update notices, and you can reach us anytime through our AI assistant and contact form.

The download starts at once. We email you the link and ask you to confirm your address. Privacy policy.