Skip to main content

Overview

The @wordpress/edit-post package provides the complete post editor screen for WordPress. It sits at the top of the three-layer editor architecture, assembling UI components, sidebars, settings panels, and plugin slots into a full editing experience.
This package is designed for WordPress core and may not be fully documented for external use. However, you can use it in your own projects with the understanding that APIs may evolve.

Three-Layer Architecture

The WordPress editor follows a three-layer architecture where each layer builds upon the previous one:

Layer Responsibilities

  • @wordpress/block-editor - Generic, WordPress-agnostic block editing functionality. Provides the canvas, block selection, and manipulation APIs.
  • @wordpress/editor - WordPress-specific features for post types. Adds document settings, post status, and entity management.
  • @wordpress/edit-post - Complete editor screen implementation. Assembles all UI elements, sidebars, toolbars, and plugin extension points.
Lower layers must never depend on higher layers. The block-editor package must remain WordPress-agnostic and cannot import from editor or edit-post.

Installation

Install the package via npm:
Environment Requirements: This package requires an ES2015+ environment. If you’re targeting older environments, include the polyfill from @wordpress/babel-preset-default.

Initializing the Editor

You initialize the post editor using the initializeEditor function:

Parameters

Initial edits are considered non-user-initiated, so they won’t trigger the “unsaved changes” warning when the user navigates away.

Extending the Editor UI

You extend the post editor UI using the registerPlugin API from @wordpress/plugins. This allows you to define all your plugin’s UI elements in a single place.

Using Plugin Components

The package exports several components for extending different areas of the editor. These components are available in the global variable wp.editPost when you define wp-edit-post as a script dependency.

Plugin Extension Components

The following components allow you to add custom UI elements to various parts of the editor:

PluginSidebar

Adds a custom sidebar to the editor with its own icon in the toolbar.
For full documentation, see the PluginSidebar reference in @wordpress/editor.

PluginSidebarMoreMenuItem

Adds a menu item to open your custom sidebar from the “More” menu.

PluginDocumentSettingPanel

Adds a custom panel to the Document settings sidebar.

PluginBlockSettingsMenuItem

Adds a custom menu item to the block settings dropdown (three-dot menu in the block toolbar).

PluginPostPublishPanel

Adds custom content to the post-publish panel that appears after publishing.

PluginPrePublishPanel

Adds custom content to the pre-publish panel that appears before publishing.

PluginPostStatusInfo

Adds custom information to the post status section of the Document sidebar.

PluginMoreMenuItem

Adds a custom menu item to the editor’s “More” menu (three-dot menu in the top toolbar).
Most of these components are re-exported from @wordpress/editor. You can use them from either package, but importing from @wordpress/editor is recommended for better compatibility.

Complete Plugin Example

Here’s a comprehensive example showing multiple extension points:

Data Store

The package provides a Redux-style data store for managing editor UI state:
The store manages UI preferences like:
  • Active editor mode (visual or code)
  • Sidebar visibility
  • Panel open/closed states
  • Feature flags and preferences

WordPress Script Dependency

When loading via WordPress’s script system, you can access the package through the global wp.editPost object:

Migration Notes

Deprecated APIs

  • reinitializeEditor() - This function is now a deprecated no-op. You don’t need to reinitialize the editor after errors.

Resources