Overview
Full Site Editing allows users to:- Edit complete page templates using blocks
- Customize reusable template parts (header, footer, sidebar)
- Manage site-wide design through Global Styles
- Create and modify templates for different contexts (home, archive, single, 404)
Core Concepts
Templates
Templates describe a full page structure. They define the layout and content for different page contexts. Template Types:- Home - Site homepage
- Singular - Individual posts and pages
- Archive - Post listings, categories, tags
- 404 - Error pages
- Search - Search results
- Custom - User-created templates
Template Parts
Template parts are reusable areas within templates, representing semantic sections: Common Template Parts:- Header - Site header and navigation
- Footer - Site footer
- Sidebar - Sidebar content
- Custom - User-defined sections
Relationship
Templates compose template parts:Storage Architecture
Templates and template parts use a hybrid storage system combining theme files and database records.Initial Storage: Theme Files
Block templates initially live as files in the theme folder, just like traditional PHP templates. File Location:User Customization: Custom Post Types
When a user edits a template in the Site Editor:- Original theme file remains unchanged
- Forked version saved to database as custom post type
- Database version takes precedence over theme file
wp_template- Customized templateswp_template_part- Customized template parts
Mixed Source Rendering
At any point, the site uses a mix of:- Theme files - Unedited templates
- Database records - Customized templates
Template Synchronization
To simplify template management, WordPress performs template synchronization.How Synchronization Works
Auto-Draft Duplication: Theme templates are duplicated in the custom post type withauto-draft status.
Status Progression:
Benefits
1. Unified Querying: REST API and rendering only need to query the CPT—no need to check theme files directly. 2. Clear Edit State:auto-draftstatus = pristine theme templatepublishstatus = user-customized template
When Synchronization Occurs
During REST API Requests: GET requests to/wp/v2/templates and /wp/v2/template-parts trigger sync.
During Template Resolution:
When WordPress determines which template to render for the current page.
During Theme Export:
When exporting a block theme to file format.
Template Resolution
Template resolution is the algorithm WordPress follows to find the right template for the current page.Resolution Flow
Template Hierarchy
Follows WordPress template hierarchy:Theme Attribution
Templates and template parts track their origin theme via thetheme post meta field.
Why Track Theme?
Each template/part CPT entry stores:thememeta - The theme identifier it originated from
- Proper association with source theme
- Future cross-theme template usage
- Clear provenance tracking
Current Behavior
For the current phase of FSE:- Templates and template parts are theme-specific
- Switching themes doesn’t carry over customizations
- Each theme has its own set of templates
Future Possibilities
Future iterations may allow:- Using header from Theme A in Theme B
- Mixing templates from different themes
- Theme-agnostic template parts
Switching Themes
When switching between block themes: Theme A → Theme B:- Theme B templates are synchronized
- Theme A’s custom templates (with
theme: theme-ameta) remain in database - Theme B’s templates (with
theme: theme-bmeta) become active - Theme A customizations preserved but inactive
Template Editing Flow
User Perspective
- User opens Site Editor
- Selects template to edit
- Makes changes using block editor
- Clicks “Save”
- Customized version saved to database
Technical Flow
Template Parts in Templates
Template parts are referenced within templates using thecore/template-part block:
slug- Template part identifiertheme- Origin themearea- Semantic area (header, footer, sidebar)
Rendering Template Parts
When rendering a template:- Template content is parsed
core/template-partblocks are detected- Corresponding template part is resolved
- Template part content is inserted
Site Editor Package
The Site Editor is implemented in@wordpress/edit-site:
Responsibilities:
- Template and template part selection UI
- Full canvas editing experience
- Global Styles interface
- Template management (create, duplicate, delete)
- Navigation structure editing
Special Blocks for Templates
Certain blocks are particularly useful in template contexts: Site Identity:core/site-title- Site namecore/site-logo- Site logocore/site-tagline- Site description
core/navigation- Site navigation menucore/page-list- Automatic page list
core/query- Post query loopcore/post-template- Post loop item template
core/template-part- Template part insertion
Best Practices
Theme Development
Provide Default Templates: Include comprehensive default templates in theme files. Use Template Parts: Create reusable template parts for common sections. Test Customization: Ensure templates work well when customized by users.User Customization
Start with Defaults: Begin with theme templates and customize as needed. Use Template Parts: Reuse template parts across multiple templates. Preview Changes: Use Site Editor preview before saving.Development
Handle Both Sources: Code should handle templates from both theme files and database. Respect Synchronization: Don’t bypass the synchronization system. Track Theme Attribution: Always set thetheme meta correctly.