diff --git a/wp-admin/includes/theme.php b/wp-admin/includes/theme.php index 420bb32c09..4ac66c1f51 100644 --- a/wp-admin/includes/theme.php +++ b/wp-admin/includes/theme.php @@ -81,7 +81,7 @@ function delete_theme($template, $redirect = '') { * @return array Key is the template name, value is the filename of the template */ function get_page_templates() { - return wp_get_theme()->get_page_templates(); + return array_flip( wp_get_theme()->get_page_templates() ); } /** diff --git a/wp-includes/class-wp-theme.php b/wp-includes/class-wp-theme.php index a58a8acc55..3f9a3803b1 100644 --- a/wp-includes/class-wp-theme.php +++ b/wp-includes/class-wp-theme.php @@ -921,10 +921,10 @@ final class WP_Theme implements ArrayAccess { $files = array_merge_recursive( $files, (array) self::scandir( $this->get_stylesheet_directory(), $this->get_stylesheet_directory(), 'php' ) ); foreach ( $files['php'] as $file ) { - $headers = get_file_data( $file, array( 'Name' => 'Template Name' ) ); - if ( empty( $headers['Name'] ) ) + $headers = get_file_data( $file, array( 'Template Name' => 'Template Name' ) ); + if ( empty( $headers['Template Name'] ) ) continue; - $page_templates[ $headers['Name'] ] = basename( $file ); + $page_templates[ basename( $file ) ] = $this->translate_header( 'Template Name', $headers['Template Name'] ); } $this->cache_add( 'page_templates', $page_templates );