Skip to content

RTC: Allow disabling collaboration for individual posts - #84026

Open
i-am-chitti wants to merge 6 commits into
WordPress:trunkfrom
i-am-chitti:add/rtc-per-post-opt-out
Open

i-am-chitti wants to merge 6 commits into
WordPress:trunkfrom
i-am-chitti:add/rtc-per-post-opt-out

Conversation

@i-am-chitti

Copy link
Copy Markdown
Contributor

What?

Closes #77431

Adds a wp_is_post_collaboration_disabled filter to disable real-time collaboration for individual posts, e.g. by post status.

Why?

#78984 allows disabling collaboration per post type, but not per post. Sites with strict publishing standards want collaboration on drafts but not on published posts.

How?

  • Adds wp_is_post_collaboration_disabled( $post ), which respects the post type check and then applies the filter with the WP_Post object.
  • Uses it in the post list (Join action, lock text, Quick Edit) and the autosave paths.
  • Adds a read-only collaboration_disabled REST field (edit context).
  • Passes the record to SyncConfig.shouldSync, so post entities with collaboration_disabled skip syncing and the editor hides collaboration UI.

The filter is evaluated on editor load; a status change mid-session applies after reload.

Open questions

  1. Is load-time evaluation enough, or should a status change stop syncing for connected peers?
  2. On a disabled post, the notes and attachment collection rooms still sync, as with the post type opt-out. Should they be skipped too?

Testing Instructions

  1. Enable the Real-time Collaboration experiment and add:
    add_filter( 'wp_is_post_collaboration_disabled', function ( $disabled, $post ) {
        return 'publish' === $post->post_status ? true : $disabled;
    }, 10, 2 );
  2. Open the same draft as two users in two browsers. Changes sync.
  3. Open the same published post as two users. Changes do not sync, and the regular post lock appears.
  4. In Posts → All Posts, the published post shows "Edit" instead of "Join".

Testing Instructions for Keyboard

No UI changes.

Use of AI

Claude Code Opus 5.5
Purpose - plan, implement, write tests, verify

@github-actions github-actions Bot added [Package] Core data /packages/core-data [Package] Editor /packages/editor [Package] Sync /packages/sync labels Oct 2, 2026
@github-actions

github-actions Bot commented Oct 2, 2026 •

Copy link
Copy Markdown

🤖 PR meta 🤖

🎉 Props

If you're merging code through a pull request on GitHub, copy and paste the following into the bottom of the merge commit message.

Co-authored-by: i-am-chitti <iamchitti@git.wordpress.org>
Co-authored-by: aaronjorbin <jorbin@git.wordpress.org>
Co-authored-by: smithjw1 <smithjw1@git.wordpress.org>

To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook.

Updated as activity occurs, without notifying anyone named here. Add the props-bot label to refresh.

🏷️ Labels

This pull request needs exactly one label indicating its type, and has 0.

  • Required: any label starting with [Type].
  • Found: none.

Read more about Type labels in Gutenberg. If you cannot add labels yourself, a reviewer can do it for you.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

[Package] Core data /packages/core-data [Package] Editor /packages/editor [Package] Sync /packages/sync

Projects

None yet

Development

Successfully merging this pull request may close these issues.

RTC: [Interface] Allow limiting Real-Time Collaboration to specific post statuses

1 participant