mirror of
https://github.com/WordPress/WordPress.git
synced 2024-11-10 21:00:59 +01:00
Editor: fix duplication in templates list.
Excludes parent template when a child template is defined during template retrieval. Props oandregal, mukesh27, flixos90, bgardner, peterwilsoncc. Reviewed by peterwilsoncc. Merges [56329] to the 6.3 branch. Fixes #57756. Built from https://develop.svn.wordpress.org/branches/6.3@56330 git-svn-id: http://core.svn.wordpress.org/branches/6.3@55842 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
1c76c022b1
commit
509e2e1c53
@ -360,6 +360,14 @@ function _get_block_templates_files( $template_type, $query = array() ) {
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* The child theme items (stylesheet) are processed before the parent theme's (template).
|
||||||
|
* If a child theme defines a template, prevent the parent template from being added to the list as well.
|
||||||
|
*/
|
||||||
|
if ( isset( $template_files[ $template_slug ] ) ) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
$new_template_item = array(
|
$new_template_item = array(
|
||||||
'slug' => $template_slug,
|
'slug' => $template_slug,
|
||||||
'path' => $template_file,
|
'path' => $template_file,
|
||||||
@ -370,7 +378,7 @@ function _get_block_templates_files( $template_type, $query = array() ) {
|
|||||||
if ( 'wp_template_part' === $template_type ) {
|
if ( 'wp_template_part' === $template_type ) {
|
||||||
$candidate = _add_block_template_part_area_info( $new_template_item );
|
$candidate = _add_block_template_part_area_info( $new_template_item );
|
||||||
if ( ! isset( $area ) || ( isset( $area ) && $area === $candidate['area'] ) ) {
|
if ( ! isset( $area ) || ( isset( $area ) && $area === $candidate['area'] ) ) {
|
||||||
$template_files[] = $candidate;
|
$template_files[ $template_slug ] = $candidate;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -380,13 +388,13 @@ function _get_block_templates_files( $template_type, $query = array() ) {
|
|||||||
! $post_type ||
|
! $post_type ||
|
||||||
( $post_type && isset( $candidate['postTypes'] ) && in_array( $post_type, $candidate['postTypes'], true ) )
|
( $post_type && isset( $candidate['postTypes'] ) && in_array( $post_type, $candidate['postTypes'], true ) )
|
||||||
) {
|
) {
|
||||||
$template_files[] = $candidate;
|
$template_files[ $template_slug ] = $candidate;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return $template_files;
|
return array_values( $template_files );
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -16,7 +16,7 @@
|
|||||||
*
|
*
|
||||||
* @global string $wp_version
|
* @global string $wp_version
|
||||||
*/
|
*/
|
||||||
$wp_version = '6.3-RC2-56328';
|
$wp_version = '6.3-RC2-56330';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.
|
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.
|
||||||
|
Loading…
Reference in New Issue
Block a user