TroubleshootingEmbed Blocked

Embed Blocked or Refused

Understand why an embed is blocked in Custom iFrame and how to fix it. Covers X-Frame-Options, Content-Security-Policy, and how to extract the correct embed URL.

Overview

When an embed is blocked, the browser refuses to display the external URL inside an iframe. This is not a plugin error. The embedded site sends HTTP response headers that instruct the browser to block the frame. This guide explains what those headers mean, how to identify them, and what you can do.

How to Confirm the Embed Is Blocked

Open the page with the embed

Go to the page where the iFrame shows blank or refuses to load.

Open browser DevTools

Press F12 (Windows/Linux) or Cmd + Option + I (Mac). Go to the Console tab.

Look for a frame error

Reload the page. A blocked embed shows one of these errors:

Refused to display 'https://example.com' in a frame because it set
'X-Frame-Options' to 'sameorigin'.
Refused to frame 'https://example.com' because an ancestor violates
the following Content Security Policy directive: "frame-ancestors 'self'"

If you see either of these, the embedded site is blocking the iframe.


Why Embeds Get Blocked

X-Frame-Options Header

X-Frame-Options is an HTTP response header. The embedded server sends it along with the page content. The browser reads it and decides whether to display the page in a frame.

Header valueWhat it means
X-Frame-Options: DENYThe page cannot be displayed in any iframe, on any site
X-Frame-Options: SAMEORIGINThe page can only be embedded on pages from the same domain
X-Frame-Options: ALLOW-FROM uriThe page allows embedding only from the specified URI (deprecated, ignored by most modern browsers)

Content-Security-Policy: frame-ancestors

Content-Security-Policy is the modern replacement for X-Frame-Options. The frame-ancestors directive controls which origins can embed the page.

DirectiveWhat it means
frame-ancestors 'none'No site can embed this page in an iframe
frame-ancestors 'self'Only the same origin can embed this page
frame-ancestors https://trusted.comOnly the specified domain can embed this page

Both headers are set by the embedded site. You cannot override them from your WordPress site, from the Custom iFrame plugin, or from the browser.


The Fix: Use the Embed src URL Instead of the Page URL

Many platforms that restrict their regular page URL still offer a separate embed URL designed specifically for iframe use. This embed URL is served from a player or embed endpoint without restrictive headers.

The platform provides this URL as part of their iframe embed code.

Find the embed code on the platform

On the platform where your content lives, look for a Share, Embed, or Get embed code option. The location varies by platform:

  • YouTube: Click Share below the video, then click Embed
  • Vimeo: Click Share, then click the Embed tab
  • Spotify: Click the three-dot menu on a track, then Share, then Embed
  • Google Maps: Click Share, then Embed a map
  • Google Calendar: Go to calendar Settings, then Integrate calendar
  • Facebook posts: Click the three-dot menu on a post, then Embed
  • LinkedIn posts: Click the three-dot menu, then Embed this post

Copy the embed code

The platform gives you an HTML snippet. It looks like this:

<iframe src="https://player.vimeo.com/video/76979871?h=abc123"
  width="640" height="360" frameborder="0"
  allow="autoplay; fullscreen" allowfullscreen>
</iframe>

Extract only the URL from the src attribute

Copy the URL value from src="...". For the example above, that is:

https://player.vimeo.com/video/76979871?h=abc123

Do not copy the full HTML tag. Copy only the URL between the quotation marks.

Paste the src URL into Custom iFrame

In Elementor or Gutenberg, paste that URL into the Source URL field in the Custom iFrame widget or block. Save and publish.

The embed src URL is the URL the platform designed for iframe use. It does not carry the same X-Frame-Options or CSP restrictions as the regular page URL.


Sites That Block Embedding

Some platforms block their regular page URLs from being embedded. Where they provide an embed code, use the src URL from that code.

PlatformRegular URL embeddable?Embed code available?
YouTubeYes (use youtube.com/embed/... format)Yes
VimeoYes (page URL works)Yes
SpotifyNo (open.spotify.com blocks)Yes — use embed URL
Google MapsNo (maps.google.com blocks)Yes — use embed URL
Google CalendarNoYes — use embed URL
Facebook pagesNoNo
Facebook postsNo (post page blocks)Yes — use plugin URL
Instagram postsNoYes — use embed URL
LinkedIn postsNoYes — use embed URL
Twitter / X postsNo — uses script-based embedsNo iframe src available
Google SearchNoNo
Most banking sitesNoNo

Twitter/X uses JavaScript-based embeds, not iframe src URLs. There is no src URL to extract. The Custom iFrame plugin handles X posts using its built-in X source type.


What to Do If There Is No Embed Code

If the platform does not provide an iframe embed code and its page URL is blocked, the content cannot be embedded in an iframe. This is a restriction enforced by the platform, not by Custom iFrame or WordPress.

Options in this situation:

  • Link to the content on the platform instead of embedding it
  • Take a screenshot and link it to the source URL
  • Use the platform's official sharing widget if one is available (these are script-based, not iframe-based)

FAQ