Guide

Embeds architecture

Maintainer overview of iframe request handling, templates, and the _embeds REST field.

Request intercept

Embeds::maybe_intercept_iframe_request runs early on parse_request. It detects /iframe/ (optional embed ID), sets iframe flags, and later selects templates while filtering content to the embed target when an ID is present.

Template resolution

  1. PHP theme overrides (bypass canvas): single-{post_name}-iframe.php, single-{post_type}-iframe.php, single-iframe.php
  2. Otherwise plugin block templates via register_block_template:
    • prc-embeds//single-iframe — branded article chrome (iframed-post-content)
    • prc-embeds//single-iframe-content — content only (iframed-content)

Design-system parts and the corner logo (prc_iframe_footer) supply branded chrome. Filters include prc_iframe_template, prc_iframe_content, prc_iframe_title, prc_iframe_embed_code.

Block attributes

block_type_metadata injects embed attributes/settings onto allowed blocks. render_block applies iframe-related markup; editor controls enqueue from build/index.js.

REST field _embeds

On rest_api_init, every public post type gets an _embeds field describing available embed URLs / embed code for that post. This is a REST field, not a custom route namespace.

Assets

Handle areaPurpose
ControlsEditor embed UI
Resizer / view-embedParent/child iframe-resizer
FooterEmbed footer script + styles

Key files

PathRole
includes/class-embeds.phpCore behavior
includes/utils.phpget_iframe_code helpers
src/Editor and view assets
templates/PHP template fallbacks

Was this helpful?