Theme Editor not displaying custom template names
|Reported by:||Terragg||Owned by:|
Wordpress Dashboard -> Design -> Theme Editor -> Theme Files listing
Any non-standard Theme Files are listed as just the file name "my_template.php (my_template.php)" instead of "My Template (my_template.php)". This occurs despite the existence of the "/* Template Name: My Template */" code block at the beginning of the file.
The template name passed to get_file_description() in file.php from theme-editor.php lines 128 and 139 is relative to the wordpress/wp-content/ directory rather than the absolute path of the installation.
get_file_description() uses the ABSPATH to attempt to read in the file. The file can't be found and it returns the just the filename. theme-editor.php does as expected and displays the returned value as the template name.
Replace instances of ABSPATH with WP_CONTENT_PATH in the get_file_description() subroutine, as get_file_description() is only referenced in theme-editor.php.
Suggested fix in file.php.diff (attached).