Editor: Fix a PHP notice appearing when adding a new template part.

This changeset fixes a PHP notice appearing when a template part is created in the site editor. It also adds a unit test case to cover 
`WP_REST_Templates_Controller::prepare_item_for_database`.

Props wildworks, dunhakdis, Rahmohn, oglekler, audrasjb, mukesh27, costdev, dunhakdis.
Fixes #57851.



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


git-svn-id: http://core.svn.wordpress.org/trunk@55760 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
audrasjb 2023-07-17 14:22:24 +00:00
parent 6443800aa6
commit 6ba79df9c4
2 changed files with 2 additions and 2 deletions

View File

@ -596,7 +596,7 @@ class WP_REST_Templates_Controller extends WP_REST_Controller {
$changes->tax_input['wp_template_part_area'] = _filter_block_template_part_area( $request['area'] );
} elseif ( null !== $template && 'custom' !== $template->source && $template->area ) {
$changes->tax_input['wp_template_part_area'] = _filter_block_template_part_area( $template->area );
} elseif ( ! $template->area ) {
} elseif ( empty( $template->area ) ) {
$changes->tax_input['wp_template_part_area'] = WP_TEMPLATE_PART_AREA_UNCATEGORIZED;
}
}

View File

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