@wordpress/edit-site package provides the site editor interface for WordPress full-site editing. It enables editing of templates, template parts, and global styles.
This package is primarily meant for use within WordPress core. While you can use it in your projects, be aware that it may not be fully documented for external use.
Installation
Basic Usage
Initialize the site editor:What is the Site Editor?
The site editor allows users to:- Edit theme templates
- Manage template parts (header, footer, etc.)
- Customize global styles
- Create and edit patterns
- Design full pages and sites
Key Features
Template Editing
Edit WordPress theme templates:- Single post templates
- Archive templates
- Page templates
- 404 templates
- Search results templates
Template Parts
Reusable template components:- Headers
- Footers
- Sidebars
- Navigation menus
Global Styles
Customize theme-wide styles:- Typography settings
- Color palettes
- Layout settings
- Spacing controls
Using with Block Themes
The site editor requires a block theme. Here’s a minimal theme structure:theme.json Example
Extending the Site Editor
While the site editor is less extensible than the post editor, you can still add customizations:Register Custom Template Types
Add Custom Block Patterns
Template Parts in Code
Insert template parts in your templates:Working with Global Styles
Access global styles in your theme:Site Editor Store
Access the edit-site store:Editor Settings
Configure the site editor with settings:Creating Custom Navigation
Add custom navigation to the site editor:Query Loop Blocks
Display dynamic content in templates:Best Practices
- Use theme.json - Define styles in theme.json for consistency
- Template Hierarchy - Follow WordPress template hierarchy
- Reusable Parts - Create template parts for common sections
- Block Patterns - Provide pre-designed layouts for users
- Test Responsiveness - Ensure templates work on all devices
Environment Requirements
This package requires:- WordPress 5.9 or later
- A block theme
- ES2015+ JavaScript environment