@@ -2406,8 +2406,6 @@ function the_block_editor_meta_boxes() {
24062406 <?php
24072407
24082408 $ meta_boxes_per_location = array ();
2409- $ rtc_compatible_ids = array ();
2410-
24112409 foreach ( $ locations as $ location ) {
24122410 $ meta_boxes_per_location [ $ location ] = array ();
24132411
@@ -2426,20 +2424,22 @@ function the_block_editor_meta_boxes() {
24262424 continue ;
24272425 }
24282426
2429- // Track meta boxes marked as compatible with real-time collaboration.
2430- if ( isset ( $ meta_box ['args ' ]['__rtc_compatible_meta_box ' ] ) && $ meta_box ['args ' ]['__rtc_compatible_meta_box ' ] ) {
2431- $ rtc_compatible_ids [] = $ meta_box ['id ' ];
2432- }
2433-
24342427 // If a meta box is just here for back compat, don't show it in the block editor.
24352428 if ( isset ( $ meta_box ['args ' ]['__back_compat_meta_box ' ] ) && $ meta_box ['args ' ]['__back_compat_meta_box ' ] ) {
24362429 continue ;
24372430 }
24382431
2439- $ meta_boxes_per_location [ $ location ][] = array (
2432+ $ meta_box_entry = array (
24402433 'id ' => $ meta_box ['id ' ],
24412434 'title ' => $ meta_box ['title ' ],
24422435 );
2436+
2437+ // Mark meta boxes compatible with real-time collaboration.
2438+ if ( ! empty ( $ meta_box ['args ' ]['__rtc_compatible_meta_box ' ] ) ) {
2439+ $ meta_box_entry ['__rtc_compatible ' ] = true ;
2440+ }
2441+
2442+ $ meta_boxes_per_location [ $ location ][] = $ meta_box_entry ;
24432443 }
24442444 }
24452445 }
@@ -2466,30 +2466,6 @@ function the_block_editor_meta_boxes() {
24662466 printf ( "<script> \n%s \n</script> \n" , trim ( $ script ) );
24672467 }
24682468
2469- /*
2470- * If collaboration is enabled and any meta boxes are marked as RTC-compatible,
2471- * pass their IDs to the editor so it can determine which meta boxes are safe
2472- * to use alongside real-time collaboration.
2473- */
2474- if ( wp_is_collaboration_enabled () && ! empty ( $ rtc_compatible_ids ) ) {
2475- $ rtc_script = 'window._wpLoadBlockEditor.then( function() {
2476- wp.data.dispatch( \'core/edit-post \' ).setRtcCompatibleMetaBoxIds( '
2477- . wp_json_encode ( array_values ( array_unique ( $ rtc_compatible_ids ) ) )
2478- . ' );
2479- } ); ' ;
2480-
2481- wp_add_inline_script ( 'wp-edit-post ' , $ rtc_script );
2482-
2483- /*
2484- * When `wp-edit-post` is output in the `<head>`, the inline script needs to be
2485- * manually printed. Otherwise, inline scripts for `wp-edit-post` will not be
2486- * printed again after this point.
2487- */
2488- if ( wp_script_is ( 'wp-edit-post ' , 'done ' ) ) {
2489- printf ( "<script> \n%s \n</script> \n" , trim ( $ rtc_script ) );
2490- }
2491- }
2492-
24932469 /*
24942470 * If the 'postcustom' meta box is enabled, then we need to perform
24952471 * some extra initialization on it.
0 commit comments