Title: wp_collaboration_inject_setting
Published: May 20, 2026

---

# wp_collaboration_inject_setting()

## In this article

 * [Source](https://developer.wordpress.org/reference/functions/wp_collaboration_inject_setting/?output_format=md#source)
 * [Related](https://developer.wordpress.org/reference/functions/wp_collaboration_inject_setting/?output_format=md#related)
 * [Changelog](https://developer.wordpress.org/reference/functions/wp_collaboration_inject_setting/?output_format=md#changelog)

[ Back to top](https://developer.wordpress.org/reference/functions/wp_collaboration_inject_setting/?output_format=md#wp--skip-link--target)

This function’s access is marked private. This means it is not intended for use 
by plugin or theme developers, only by core. It is listed here for completeness.

Injects the real-time collaboration setting into a global variable.

## 󠀁[Source](https://developer.wordpress.org/reference/functions/wp_collaboration_inject_setting/?output_format=md#source)󠁿

    ```php
    function wp_collaboration_inject_setting() {
    	global $pagenow;

    	if ( ! wp_is_collaboration_enabled() ) {
    		return;
    	}

    	// Disable real-time collaboration on the site editor.
    	$enabled = true;
    	if ( 'site-editor.php' === $pagenow ) {
    		$enabled = false;
    	}

    	wp_add_inline_script(
    		'wp-core-data',
    		'window._wpCollaborationEnabled = ' . wp_json_encode( $enabled ) . ';',
    		'after'
    	);
    }
    ```

[View all references](https://developer.wordpress.org/reference/files/wp-includes/collaboration.php/)
[View on Trac](https://core.trac.wordpress.org/browser/tags/7.0/src/wp-includes/collaboration.php#L67)
[View on GitHub](https://github.com/WordPress/wordpress-develop/blob/7.0/src/wp-includes/collaboration.php#L67-L85)

## 󠀁[Related](https://developer.wordpress.org/reference/functions/wp_collaboration_inject_setting/?output_format=md#related)󠁿

| Uses | Description | 
| [wp_is_collaboration_enabled()](https://developer.wordpress.org/reference/functions/wp_is_collaboration_enabled/)`wp-includes/collaboration.php` |

Determines whether real-time collaboration is enabled.

  | 
| [wp_add_inline_script()](https://developer.wordpress.org/reference/functions/wp_add_inline_script/)`wp-includes/functions.wp-scripts.php` |

Adds extra code to a registered script.

  | 
| [wp_json_encode()](https://developer.wordpress.org/reference/functions/wp_json_encode/)`wp-includes/functions.php` |

Encodes a variable into JSON, with some confidence checks.

  |

[Show 1 more](https://developer.wordpress.org/reference/functions/wp_collaboration_inject_setting/?output_format=md#)
[Show less](https://developer.wordpress.org/reference/functions/wp_collaboration_inject_setting/?output_format=md#)

## 󠀁[Changelog](https://developer.wordpress.org/reference/functions/wp_collaboration_inject_setting/?output_format=md#changelog)󠁿

| Version | Description | 
| [7.0.0](https://developer.wordpress.org/reference/since/7.0.0/) | Introduced. |

## User Contributed Notes

You must [log in](https://login.wordpress.org/?redirect_to=https%3A%2F%2Fdeveloper.wordpress.org%2Freference%2Ffunctions%2Fwp_collaboration_inject_setting%2F)
before being able to contribute a note or feedback.