diff --git a/wp-includes/class-wp-theme.php b/wp-includes/class-wp-theme.php index 2f9e60b35c..4a36addfbf 100644 --- a/wp-includes/class-wp-theme.php +++ b/wp-includes/class-wp-theme.php @@ -1250,9 +1250,17 @@ 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 ) { + if ( ! $block_template->is_custom ) { + continue; + } + + if ( isset( $block_template->post_types ) && ! in_array( $type, $block_template->post_types, true ) ) { + continue; + } + $post_templates[ $type ][ $block_template->slug ] = $block_template->title; } } diff --git a/wp-includes/version.php b/wp-includes/version.php index 5e99d0e463..ad4a73f1ca 100644 --- a/wp-includes/version.php +++ b/wp-includes/version.php @@ -16,7 +16,7 @@ * * @global string $wp_version */ -$wp_version = '5.9-beta2-52364'; +$wp_version = '5.9-beta2-52365'; /** * Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.