Editor: rename sync_status and move it to top level.

Renames sync_status to wp_pattern_sync_status and moves it to top level field of wp_block post type.

Props glendaviesnz, aaronrobertshaw, mukesh27, peterwilsoncc.
Fixes 58677.

Built from https://develop.svn.wordpress.org/trunk@56160


git-svn-id: http://core.svn.wordpress.org/trunk@55672 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
isabel_brison 2023-07-07 07:29:23 +00:00
parent 2405b7fbf7
commit ab8c2bd924
3 changed files with 7 additions and 3 deletions

View File

@ -8041,14 +8041,14 @@ function use_block_editor_for_post_type( $post_type ) {
/**
* Registers any additional post meta fields.
*
* @since 6.3.0 Adds sync_status meta field to the wp_block post type so an unsynced option can be added.
* @since 6.3.0 Adds `wp_pattern_sync_status` meta field to the wp_block post type so an unsynced option can be added.
*
* @link https://github.com/WordPress/gutenberg/pull/51144
*/
function wp_create_initial_post_meta() {
register_post_meta(
'wp_block',
'sync_status',
'wp_pattern_sync_status',
array(
'sanitize_callback' => 'sanitize_text_field',
'single' => true,

View File

@ -40,6 +40,7 @@ class WP_REST_Blocks_Controller extends WP_REST_Posts_Controller {
* Filters a response based on the context defined in the schema.
*
* @since 5.0.0
* @since 6.3 Adds the `wp_pattern_sync_status` postmeta property to the top level of response.
*
* @param array $data Response data to filter.
* @param string $context Context defined in the schema.
@ -56,6 +57,9 @@ class WP_REST_Blocks_Controller extends WP_REST_Posts_Controller {
unset( $data['title']['rendered'] );
unset( $data['content']['rendered'] );
// Add the core wp_pattern_sync_status meta as top level property to the response.
$data['wp_pattern_sync_status'] = isset( $data['meta']['wp_pattern_sync_status'] ) ? $data['meta']['wp_pattern_sync_status'] : '';
unset( $data['meta']['wp_pattern_sync_status'] );
return $data;
}

View File

@ -16,7 +16,7 @@
*
* @global string $wp_version
*/
$wp_version = '6.3-beta3-56159';
$wp_version = '6.3-beta3-56160';
/**
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.