Skip to content

Commit b9bddfc

Browse files
RTC: Use activation hook to enable RTC by default (#76736)
* Use activation hook to enable RTC by default * Fix plugin file reference * Directly hook into the `activate_` function for enabling collaboration * Add PR backport for opt-in change --------- Co-authored-by: Alec Geatches <alec.geatches@automattic.com>
1 parent f768c1e commit b9bddfc

File tree

2 files changed

+7
-3
lines changed

2 files changed

+7
-3
lines changed

backport-changelog/7.0/11289.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
11
https://github.com/WordPress/wordpress-develop/pull/11289
22

33
* https://github.com/WordPress/gutenberg/pull/76643
4+
* https://github.com/WordPress/gutenberg/pull/76736

lib/compat/wordpress-7.0/collaboration.php

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -170,10 +170,13 @@ function gutenberg_inject_real_time_collaboration_setting() {
170170
add_action( 'admin_init', 'gutenberg_inject_real_time_collaboration_setting' );
171171

172172
/**
173-
* Core filters the default value, so hook with a higher priority to ensure the
174-
* setting is enabled by default when the Gutenberg plugin is active.
173+
* Core adds an option with the default value, so we need to set the option to
174+
* our intended default when the Gutenberg plugin is activated.
175175
*/
176-
add_filter( 'default_option_wp_collaboration_enabled', '__return_true', 500 );
176+
function gutenberg_set_collaboration_option_on_activation() {
177+
update_option( 'wp_collaboration_enabled', '1' );
178+
}
179+
add_action( 'activate_gutenberg/gutenberg.php', 'gutenberg_set_collaboration_option_on_activation' );
177180

178181
/**
179182
* Modifies the post list UI and heartbeat responses for real-time collaboration.

0 commit comments

Comments
 (0)