Make WordPress Core

Opened 10 years ago

Closed 10 years ago

Last modified 10 years ago

#7575 closed defect (bug) (fixed)

Theme Editor not displaying custom template names

Reported by: Terragg Owned by:
Milestone: 2.7 Priority: low
Severity: minor Version: 2.6.1
Component: Administration Keywords: has-patch, needs-testing
Focuses: Cc:



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).

Attachments (1)

file.php.diff (719 bytes) - added by Terragg 10 years ago.
svn diff output for suggested changes to file.php

Download all attachments as: .zip

Change History (5)

10 years ago

svn diff output for suggested changes to file.php

#1 @Terragg
10 years ago

  • Keywords has-patch needs-testing added

#2 @ryan
10 years ago

  • Resolution set to fixed
  • Status changed from new to closed

(In [8716]) Use WP_CONTENT_PATH to find find files. Props Terragg. fixes #7575 for trunk

#3 @ryan
10 years ago

  • Milestone set to 2.7

#4 @westi
10 years ago

Hmm.. WP_CONTENT_PATH. what were you smoking Ryan?

It's WP_CONTENT_DIR - fixed in [8718] - only noticed this ticket after fixing it!

Note: See TracTickets for help on using tickets.