From 78e8a3db6557423bfae6d6c3ab993ac0d3c42a46 Mon Sep 17 00:00:00 2001 From: Sergey Biryukov Date: Tue, 10 Aug 2021 17:56:57 +0000 Subject: [PATCH] Editor: Preserve the original template keys when preparing a list of page templates. Previously, the original "404" template key was lost when "Default template" is merged into the available templates array, as the `array_merge()` function renumbers numeric keys. Later, when we merge templates on the client side, this caused duplicate "404" templates to appear in the dropdown. By replacing the `array_merge()` call with `array_replace()`, we make sure to keep the original numeric keys. Props Mamaduka, Toro_Unit, youknowriad. Fixes #53898. Built from https://develop.svn.wordpress.org/trunk@51595 git-svn-id: http://core.svn.wordpress.org/trunk@51206 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- wp-admin/edit-form-blocks.php | 2 +- wp-includes/version.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/wp-admin/edit-form-blocks.php b/wp-admin/edit-form-blocks.php index 3a399c2fcd..fa4b8a9dd1 100644 --- a/wp-admin/edit-form-blocks.php +++ b/wp-admin/edit-form-blocks.php @@ -119,7 +119,7 @@ wp_add_inline_script( * besides the default value. */ $available_templates = wp_get_theme()->get_page_templates( get_post( $post->ID ) ); -$available_templates = ! empty( $available_templates ) ? array_merge( +$available_templates = ! empty( $available_templates ) ? array_replace( array( /** This filter is documented in wp-admin/includes/meta-boxes.php */ '' => apply_filters( 'default_page_template_title', __( 'Default template' ), 'rest-api' ), diff --git a/wp-includes/version.php b/wp-includes/version.php index c822348d9c..498ff9d131 100644 --- a/wp-includes/version.php +++ b/wp-includes/version.php @@ -13,7 +13,7 @@ * * @global string $wp_version */ -$wp_version = '5.9-alpha-51594'; +$wp_version = '5.9-alpha-51595'; /** * Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.