Skip to content

Add WP_DISABLE_COLLABORATION constant#11311

Open
alecgeatches wants to merge 3 commits intoWordPress:trunkfrom
alecgeatches:add/disable-collaboration-flag
Open

Add WP_DISABLE_COLLABORATION constant#11311
alecgeatches wants to merge 3 commits intoWordPress:trunkfrom
alecgeatches:add/disable-collaboration-flag

Conversation

@alecgeatches
Copy link

@alecgeatches alecgeatches commented Mar 19, 2026

Add WP_DISABLE_COLLABORATION constant and wrapper wp_is_collaboration_enabled() function. Based on UI changes in #11310.

WP_DISABLE_COLLABORATION only has a function when it is set to true. Otherwise, the feature can be disabled or enabled via the existing Settings -> Writing checkbox.

Trac ticket: https://core.trac.wordpress.org/ticket/64904

Screenshots

With

define('WP_DISABLE_COLLABORATION', true );
Screenshot 2026-03-19 at 3 13 13 PM

With

define('WP_DISABLE_COLLABORATION', false );

or no WP_DISABLE_COLLABORATION configuration at all, the default checkbox:

Screenshot 2026-03-19 at 3 13 28 PM

Use of AI Tools

AI assistance: Yes
Tool(s): Claude
Model(s): Opus 4.6
Used for: Implementation

@github-actions
Copy link

The following accounts have interacted with this PR and/or linked issues. I will continue to update these lists as activity occurs. You can also manually ask me to refresh this list by adding the props-bot label.

Core Committers: Use this line as a base for the props when committing in SVN:

Props alecgeatches.

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

@github-actions
Copy link

Test using WordPress Playground

The changes in this pull request can previewed and tested using a WordPress Playground instance.

WordPress Playground is an experimental project that creates a full WordPress instance entirely within the browser.

Some things to be aware of

  • All changes will be lost when closing a tab with a Playground instance.
  • All changes will be lost when refreshing the page.
  • A fresh instance is created each time the link below is clicked.
  • Every time this pull request is updated, a new ZIP file containing all changes is created. If changes are not reflected in the Playground instance,
    it's possible that the most recent build failed, or has not completed. Check the list of workflow runs to be sure.

For more details about these limitations and more, check out the Limitations page in the WordPress Playground documentation.

Test this pull request with WordPress Playground.

Copy link
Contributor

@peterwilsoncc peterwilsoncc left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have a few of suggestions.

  1. Instead of a constant with a negative intent, it is clearer to use a positive intent. This avoids having code along the lines of if ( CONSTANT === true ) then false;
  2. It's more precise to describe the constant as whether or not RTC is permitted, than whether RTC is enabled or disabled. I think WP_ALLOW_COLLABORATION is a better match for that intent.
  3. As a part of the consideration is to allow hosts to disallow the feature at an environment level, allowing an environment variable to be set will help meet their needs
  4. Instead of needing to repeat the ! defined() && ..., define the default value in wp_functionality_constants()

My suggestion is to add the following to wp_functionality_constants() and modify the PR for the various implications

/**
 * Whether real time collaboration is permitted to be enabled.
 *
 * @since 7.0.0
 */
if ( ! defined( 'WP_ALLOW_COLLABORATION' ) ) {
	if ( false !== getenv( 'WP_ALLOW_COLLABORATION' ) ) {
		// Environment variable is defined.
		if ( 'true' === getenv( 'WP_ALLOW_COLLABORATION' ) ) {
			define( 'WP_ALLOW_COLLABORATION', true );
		} else {
			define( 'WP_ALLOW_COLLABORATION', false );
		}
	} else {
		// Environment variable is not defined, default to true.
		define( 'WP_ALLOW_COLLABORATION', true );
	}
}

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants