Skip to content

Commit d0097e4

Browse files
committed
Move meta registration to wp_create_initial_post_meta().
1 parent 3585f13 commit d0097e4

2 files changed

Lines changed: 21 additions & 27 deletions

File tree

src/wp-includes/collaboration.php

Lines changed: 0 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -83,29 +83,3 @@ function wp_collaboration_inject_setting() {
8383
'after'
8484
);
8585
}
86-
87-
/**
88-
* Register post meta used for real-time collaboration.
89-
*/
90-
function wp_collaboration_register_meta() {
91-
register_post_meta(
92-
WP_Sync_Post_Meta_Storage::POST_TYPE,
93-
WP_Sync_Post_Meta_Storage::SYNC_UPDATE_META_KEY,
94-
array(
95-
'show_in_rest' => false,
96-
'jit_cache_invalidation' => true,
97-
)
98-
);
99-
100-
// @todo This should probably go elsewhere.
101-
register_post_meta(
102-
'',
103-
'_edit_lock',
104-
array(
105-
'show_in_rest' => false,
106-
'jit_cache_invalidation' => true,
107-
)
108-
);
109-
}
110-
111-
add_action( 'init', 'wp_collaboration_register_meta', 20 );

src/wp-includes/post.php

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8689,7 +8689,9 @@ function use_block_editor_for_post_type( $post_type ) {
86898689
* Registers any additional post meta fields.
86908690
*
86918691
* @since 6.3.0 Adds `wp_pattern_sync_status` meta field to the wp_block post type so an unsynced option can be added.
8692-
* @since 7.0.0 Adds `_crdt_document` meta field to post types so that CRDT documents can be persisted.
8692+
* @since 7.0.0 Adds `_edit_lock` for use of just-in-time cache invalidation; `_crdt_document` meta field to post types so that CRDT
8693+
* documents can be persisted and `WP_Sync_Post_Meta_Storage::SYNC_UPDATE_META_KEY` to the sync post type for storing
8694+
* pending sync updates.
86938695
*
86948696
* @link https://github.com/WordPress/gutenberg/pull/51144
86958697
*/
@@ -8710,6 +8712,15 @@ function wp_create_initial_post_meta() {
87108712
)
87118713
);
87128714

8715+
register_post_meta(
8716+
'',
8717+
'_edit_lock',
8718+
array(
8719+
'show_in_rest' => false,
8720+
'jit_cache_invalidation' => true,
8721+
)
8722+
);
8723+
87138724
if ( wp_is_collaboration_enabled() ) {
87148725
register_meta(
87158726
'post',
@@ -8734,5 +8745,14 @@ function wp_create_initial_post_meta() {
87348745
'type' => 'string',
87358746
)
87368747
);
8748+
8749+
register_post_meta(
8750+
WP_Sync_Post_Meta_Storage::POST_TYPE,
8751+
WP_Sync_Post_Meta_Storage::SYNC_UPDATE_META_KEY,
8752+
array(
8753+
'show_in_rest' => false,
8754+
'jit_cache_invalidation' => true,
8755+
)
8756+
);
87378757
}
87388758
}

0 commit comments

Comments
 (0)