From 3dada8377b7e6cb3cdd7f1c558b9eeca284ad898 Mon Sep 17 00:00:00 2001 From: Riad Benguella Date: Tue, 7 Dec 2021 16:31:59 +0000 Subject: [PATCH] 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 --- src/wp-includes/class-wp-theme.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/wp-includes/class-wp-theme.php b/src/wp-includes/class-wp-theme.php index b5ac408278..2f9e60b35c 100644 --- a/src/wp-includes/class-wp-theme.php +++ b/src/wp-includes/class-wp-theme.php @@ -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; }