Make WordPress Core


Ignore:
Timestamp:
02/19/2026 10:25:06 AM (3 months ago)
Author:
ellatrix
Message:

Real-time collaboration: add new REST endpoints, setting, and registered post meta.

Syncs/merges the PHP changes from the Gutenberg PR https://github.com/WordPress/gutenberg/pull/75366.

In Gutenberg, we have added support for real-time collaboration using CRDT documents (via the [Yjs library](https://yjs.dev/)). This work has suggested the following additions to WordPress:

  1. A default "sync provider" based on HTTP polling that allows collaborators to share updates with each other. Previously, we relied on WebRTC connections between collaborators for this purpose, but it proved unreliable under many network conditions.
    • Our solution is designed to work on any WordPress installation.
    • HTTP polling is the transport we identified as most likely to work universally.
    • Given the isolation and lifecycle of PHP processes, updates must be stored centrally in order to be shared among peers. We have chosen to store updates in post meta against a special post type, but alternate storage mechanisms are possible.
    • Collaborative editing can involve syncing multiple CRDT documents. To limit the number of connections consumed by this provider, requests are batched.
    • To prevent unbounded linear growth, updates are periodically compacted.
    • To avoid excessive load on lower-resourced hosts, this provider will benefit from usage limits (e.g., a maximum of three connected collaborators) enforced by the client (Gutenberg).
  1. A new registered post meta that allows Gutenberg to persist CRDT documents alongside posts.
    • This provides all collaborators with a "shared starting point" for the collaborative session, which avoids duplicate updates.
    • Content stored in the WordPress database always remains the source of truth. If the content differs from the persisted CRDT document, the CRDT document is updated to match the database.
  1. A new Writing setting that allows users to opt-in to real-time collaboration.
    • Enabling real-time collaboration disables post lock functionality and connects users to the sync provider.
  1. A behavior change to autosaves is needed. When the the original author is editing a draft post (post_status == 'draft' OR 'auto-draft') and they hold the post lock, the autosave targets the actual post instead of an autosave revision. This puts the post data and the persisted CRDT document out of sync and leads to duplicate updates. When real-time collaboration is enabled, all collaborators must autosave in the same way.

This PR provides a proposed implementation of the changes above. This corresponding Gutenberg PR moves the work from the experimental directory to lib/compat:

https://github.com/WordPress/gutenberg/pull/75366

Cumulative work to add this functionality can be found using this label:

https://github.com/WordPress/gutenberg/issues?q=label%3A%22%5BFeature%5D%20Real-time%20Collaboration%22%20is%3Apr

Developed https://github.com/WordPress/wordpress-develop/pull/10894.

Props czarate, paulkevan, ellatrix, timothyblynjacobs, westonruter, jorgefilipecosta, mindctrl.
Fixes #64622.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/default-filters.php

    r61661 r61689  
    787787add_action( 'init', '_wp_register_default_font_collections' );
    788788
     789// Collaboration.
     790add_action( 'admin_init', 'wp_collaboration_inject_setting' );
     791
    789792// Add ignoredHookedBlocks metadata attribute to the template and template part post types.
    790793add_filter( 'rest_pre_insert_wp_template', 'inject_ignored_hooked_blocks_metadata_attributes' );
Note: See TracChangeset for help on using the changeset viewer.