Editor: Ensure `get_block_templates()` returns unique templates or template parts.
The function was using the `array_column()` PHP function on an array of objects, which works as expected on PHP 7 or later, but not on PHP 5.6. This resulted in customized templates being listed multiple times on the Templates and Template Parts screens, and being repeatedly added between lists when switching between the screens. The issue is now resolved by replacing `array_column()` with the `wp_list_pluck()` WordPress core function, which provides consistent behavior beetween PHP versions. Reference: [https://github.com/php/php-src/blob/PHP-7.0.0/UPGRADING#L626 PHP 7.0 Upgrade Notes: array_column()]. Props uofaberdeendarren, antonvlasenko, ironprogrammer, jonmackintosh, costdev, hellofromTonya, swissspidy, rudlinkon. Merges [53927] to the 6.0 branch. Fixes #56271. Built from https://develop.svn.wordpress.org/branches/6.0@53928 git-svn-id: http://core.svn.wordpress.org/branches/6.0@53487 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
40451dee2e
commit
bd2cb12160
|
@ -705,7 +705,7 @@ function get_block_templates( $query = array(), $template_type = 'wp_template' )
|
|||
|
||||
$is_not_custom = false === array_search(
|
||||
wp_get_theme()->get_stylesheet() . '//' . $template_file['slug'],
|
||||
array_column( $query_result, 'id' ),
|
||||
wp_list_pluck( $query_result, 'id' ),
|
||||
true
|
||||
);
|
||||
$fits_slug_query =
|
||||
|
|
|
@ -16,7 +16,7 @@
|
|||
*
|
||||
* @global string $wp_version
|
||||
*/
|
||||
$wp_version = '6.0.2-alpha-53926';
|
||||
$wp_version = '6.0.2-alpha-53928';
|
||||
|
||||
/**
|
||||
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.
|
||||
|
|
Loading…
Reference in New Issue