WordPress.org

Make WordPress Core

Ticket #33388: 33388.diff

File 33388.diff, 790 bytes (added by m_uysl, 3 years ago)

depends on #33387

  • src/wp-includes/class-wp-theme.php

     
    10131013                        $files = (array) $this->get_files( 'php', 1 );
    10141014
    10151015                        foreach ( $files as $file => $full_path ) {
    1016                                 if ( ! preg_match( '|Template Name:(.*)$|mi', file_get_contents( $full_path ), $header ) )
     1016                                $headers = get_file_data( $full_path, array( 'Template Name' => 'Template Name' ) );
     1017                                if ( empty( $headers['Template Name'] ) )
    10171018                                        continue;
    1018                                 $page_templates[ $file ] = _cleanup_header_comment( $header[1] );
     1019                                $page_templates[ $file ] = $headers['Template Name'];
    10191020                        }
    10201021
    10211022                        $this->cache_add( 'page_templates', $page_templates );