diff --git a/lib/full-site-editing/page-templates.php b/lib/full-site-editing/page-templates.php index 89ce31dba143f0..46ce5f37c64914 100644 --- a/lib/full-site-editing/page-templates.php +++ b/lib/full-site-editing/page-templates.php @@ -17,15 +17,9 @@ function gutenberg_load_block_page_templates( $templates, $theme, $post ) { if ( ! gutenberg_is_fse_theme() ) { return $templates; } - $config_file = locate_template( 'experimental-theme.json' ); - if ( ! file_exists( $config_file ) ) { - return $templates; - } - $data = json_decode( - file_get_contents( $config_file ), - true - ); - $page_templates = array(); + + $resolver = WP_Theme_JSON_Resolver(); + $page_templates = $resolver->get_theme_data()->get_page_templates(); if ( isset( $data['pageTemplates'] ) ) { foreach ( $data['pageTemplates'] as $key => $page_template ) { if ( ( ! isset( $page_template['postTypes'] ) && 'page' === $post->post_type ) ||