Skip to content

Instantly share code, notes, and snippets.

@peterwilsoncc
Created March 12, 2026 22:02
Show Gist options
  • Select an option

  • Save peterwilsoncc/d1db09cb4524e077be75b6f0749eddd1 to your computer and use it in GitHub Desktop.

Select an option

Save peterwilsoncc/d1db09cb4524e077be75b6f0749eddd1 to your computer and use it in GitHub Desktop.
An mu-plugin for WordPress to disable RTC by default without preventing its use later.
<?php
/**
* Override WordPress upgrade defaults.
*
* Modify defaults set during the upgrade routine.
*
* @package pwcc-site
*/
namespace PWCC\Upgrade;
/**
* Bootstrap for upgrade related overrides.
*
* Runs as the plugin is included.
*/
function bootstrap() {
add_action( 'wp_upgrade', __NAMESPACE__ . '\\disable_real_time_collaboration_by_default', 10, 2 );
}
// Bootstrap immediately when the plugin is loaded.
bootstrap();
/**
* Disable Real Time Collaboration by default after upgrade.
*
* @param int $new_db_version The new database version.
* @param int $old_db_version The old database version.
*/
function disable_real_time_collaboration_by_default( $new_db_version, $old_db_version ) {
if ( $old_db_version < 61644 ) {
update_option( 'wp_enable_real_time_collaboration', '0' );
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment