diff --git a/src/wp-admin/options-writing.php b/src/wp-admin/options-writing.php
index c333d1910879f..d40dc0578b315 100644
--- a/src/wp-admin/options-writing.php
+++ b/src/wp-admin/options-writing.php
@@ -112,15 +112,15 @@
|
-
-
- Note: Real-time collaboration has been disabled.' ); ?>
-
-
+
+
+
+ Note: Real-time collaboration has been disabled.' ); ?>
+
|
diff --git a/src/wp-includes/collaboration.php b/src/wp-includes/collaboration.php
index 218f1feda4df7..11698a2ac78f4 100644
--- a/src/wp-includes/collaboration.php
+++ b/src/wp-includes/collaboration.php
@@ -18,11 +18,41 @@
* @return bool Whether real-time collaboration is enabled.
*/
function wp_is_collaboration_enabled() {
- if ( ! defined( 'WP_ALLOW_COLLABORATION' ) || ! WP_ALLOW_COLLABORATION ) {
- return false;
+ return (
+ wp_is_collaboration_allowed() &&
+ (bool) get_option( 'wp_collaboration_enabled' )
+ );
+}
+
+/**
+ * Determines whether real-time collaboration is allowed.
+ *
+ * If the WP_ALLOW_COLLABORATION constant is false,
+ * collaboration is not allowed and cannot be enabled.
+ * The constant defaults to true, unless the WP_ALLOW_COLLABORATION
+ * environment variable is set to string "false".
+ *
+ * @since 7.0.0
+ *
+ * @return bool Whether real-time collaboration is enabled.
+ */
+function wp_is_collaboration_allowed() {
+ if ( ! defined( 'WP_ALLOW_COLLABORATION' ) ) {
+ $env_value = getenv( 'WP_ALLOW_COLLABORATION' );
+ if ( false === $env_value ) {
+ // Environment variable is not defined, default to allowing collaboration.
+ define( 'WP_ALLOW_COLLABORATION', true );
+ } else {
+ /*
+ * Environment variable is defined, let's confirm it is actually set to
+ * "true" as it may still have a string value "false" – the preceeding
+ * `if` branch only tests for the boolean `false`.
+ */
+ define( 'WP_ALLOW_COLLABORATION', 'true' === $env_value );
+ }
}
- return (bool) get_option( 'wp_collaboration_enabled' );
+ return WP_ALLOW_COLLABORATION;
}
/**
diff --git a/src/wp-includes/default-constants.php b/src/wp-includes/default-constants.php
index ab0b3d6cceb9f..acfc878fb7138 100644
--- a/src/wp-includes/default-constants.php
+++ b/src/wp-includes/default-constants.php
@@ -398,26 +398,6 @@ function wp_functionality_constants() {
if ( ! defined( 'WP_CRON_LOCK_TIMEOUT' ) ) {
define( 'WP_CRON_LOCK_TIMEOUT', MINUTE_IN_SECONDS );
}
-
- /**
- * Whether real time collaboration is permitted to be enabled.
- *
- * @since 7.0.0
- */
- if ( ! defined( 'WP_ALLOW_COLLABORATION' ) ) {
- $env_value = getenv( 'WP_ALLOW_COLLABORATION' );
- if ( false === $env_value ) {
- // Environment variable is not defined, default to allowing collaboration.
- define( 'WP_ALLOW_COLLABORATION', true );
- } else {
- /*
- * Environment variable is defined, let's confirm it is actually set to
- * "true" as it may still have a string value "false" – the preceeding
- * `if` branch only tests for the boolean `false`.
- */
- define( 'WP_ALLOW_COLLABORATION', 'true' === $env_value );
- }
- }
}
/**