wp_is_collaboration_allowed()WP 7.0.0

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".

No Hooks.

Returns

true|false. Whether real-time collaboration is enabled.

Usage

wp_is_collaboration_allowed();

Changelog

Since 7.0.0 Introduced.

wp_is_collaboration_allowed() code WP 7.0

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 WP_ALLOW_COLLABORATION;
}