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
- PHP theme overrides (bypass canvas):
single-{post_name}-iframe.php,single-{post_type}-iframe.php,single-iframe.php - 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 area | Purpose |
|---|---|
| Controls | Editor embed UI |
| Resizer / view-embed | Parent/child iframe-resizer |
| Footer | Embed footer script + styles |
Key files
| Path | Role |
|---|---|
includes/class-embeds.php | Core behavior |
includes/utils.php | get_iframe_code helpers |
src/ | Editor and view assets |
templates/ | PHP template fallbacks |