Injects the real-time collaboration setting into a global variable.
Source
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'
);
}
Changelog
| Version | Description |
|---|---|
| 7.0.0 | Introduced. |
User Contributed Notes
You must log in before being able to contribute a note or feedback.