ℹ️ Opt-in feature: Block editor support and the REST API for documents are supported but opt-in. The classic editor remains the default because it provides a streamlined, purpose-built upload interface. Enable the block editor when you prefer the modern WordPress editing experience for documents. Found a rough edge? Please report it.
WP Document Revisions supports the WordPress block editor (Gutenberg) for documents. By default, documents use the classic editor, which provides a streamlined, purpose-built upload interface. Enable the block editor when you want the newer WordPress editing experience for documents — the upload flow is exercised by the plugin’s end-to-end test suite.
Add the following two filters to your theme’s functions.php or a custom plugin:
// Enable REST API for documents (required for block editor).
add_filter( 'document_show_in_rest', '__return_true' );
// Enable the block editor for documents.
add_filter( 'document_use_block_editor', '__return_true' );
Alternatively, create a must-use plugin at wp-content/mu-plugins/enable-block-editor.php:
<?php
// Enable the block editor for documents.
add_filter( 'document_show_in_rest', '__return_true' );
add_filter( 'document_use_block_editor', '__return_true' );
To disable the block editor, simply remove these filters.
Both filters are required. document_show_in_rest exposes documents to the WordPress REST API, and document_use_block_editor configures the plugin for block editor compatibility (enables Gutenberg for documents, allows REST write methods, adds excerpt support, and registers post meta). Enabling document_show_in_rest alone provides read-only REST API access without the block editor.
When the block editor is enabled, a Document panel appears in the Settings sidebar with the following features:
post_content on saveA textarea field for describing what changed in this version. This maps to the post excerpt and appears in the document’s revision history, just like the classic editor’s “Revision Summary” metabox.
When another user is editing the document, a warning banner shows their name and the upload button is disabled. This uses the WordPress core editor lock (not the plugin’s custom document lock with document_lock_check filter).
New documents cannot be published until a file is attached. The editor’s Publish/Update button is locked until you select a file.
| Feature | Classic Editor | Block Editor |
|---|---|---|
| Upload method | ThickBox iframe with plupload | WordPress media library modal |
| File storage | Direct post_content write |
REST API meta sync |
| Feedback | Inline HTML notices | WordPress Snackbar notices |
| Lock system | Plugin’s document_lock_check filter |
Core editor lock |
| Revision summary | Custom metabox | Sidebar textarea (post excerpt) |
| Workflow states | Taxonomy metabox | Taxonomy panel in sidebar |
When block editor support is enabled, documents are exposed via the WordPress REST API at /wp-json/wp/v2/{document_slug}/. The plugin registers a document_attachment_id post meta field for REST read/write, and automatically syncs it to post_content (where the attachment reference is stored as <!-- WPDR {ID} -->).
POST, PUT, and DELETE methods are allowed when the block editor is enabled. All write methods require a valid nonce.
WP Document Revisions also provides four Gutenberg blocks for displaying documents on the front end, available regardless of whether the document post type uses the block editor:
wp-document-revisions/documents-shortcode) — Displays a list of documents, equivalent to the [documents] shortcodewp-document-revisions/documents-widget) — Shows recently updated documents, equivalent to the sidebar widgetwp-document-revisions/revisions-shortcode) — Shows the revision history for a specific document, equivalent to the [document_revisions] shortcodewp-document-revisions/document-preview) — Embeds an inline preview of a document’s latest revision, equivalent to the [document_preview] shortcodedocument_lock_check filter used in the classic editor