Block Editor: Only list custom block templates in the template selector.

Previously all block templates including the hierarchy templates were being shown in the CPT template selector.

Props mamaduka.
See #54335.


git-svn-id: https://develop.svn.wordpress.org/trunk@52334 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Riad Benguella 2021-12-07 16:31:59 +00:00
parent cc0ec8e72a
commit 3dada8377b

View File

@ -1250,8 +1250,8 @@ final class WP_Theme implements ArrayAccess {
}
if ( current_theme_supports( 'block-templates' ) ) {
$block_templates = get_block_templates( array(), 'wp_template' );
foreach ( get_post_types( array( 'public' => true ) ) as $type ) {
$block_templates = get_block_templates( array( 'post_type' => $type ), 'wp_template' );
foreach ( $block_templates as $block_template ) {
$post_templates[ $type ][ $block_template->slug ] = $block_template->title;
}