@wordpress/edit-post package provides the post editor interface for WordPress. It includes components and functionality for extending the post editor UI.
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
Extending the Post Editor
The primary way to extend the post editor is through theregisterPlugin API:
Plugin Components
PluginSidebar
Adds a custom sidebar to the post editor.PluginSidebarMoreMenuItem
Adds a menu item to open your sidebar.PluginDocumentSettingPanel
Adds a panel to the document settings sidebar.PluginPostStatusInfo
Adds content to the post status section.PluginPrePublishPanel
Adds content to the pre-publish panel.PluginPostPublishPanel
Adds content to the post-publish panel.PluginMoreMenuItem
Adds an item to the more menu (three dots).PluginBlockSettingsMenuItem
Adds an item to the block settings menu.Initializing the Editor
TheinitializeEditor function sets up the post editor:
Store
Access the edit-post store for UI state:Complete Plugin Example
Here’s a complete example of a post editor plugin:Best Practices
- Use the Plugin API - Always use
registerPluginfor extensions - Unique Names - Ensure plugin and component names are unique
- Proper Icons - Use WordPress dashicons for consistency
- Conditional Rendering - Show controls only when relevant
- Persist Settings - Save custom data in post meta or options