WordPress.org

Make WordPress Core

Opened 4 years ago

Closed 4 years ago

#11121 closed defect (bug) (fixed)

get_page_templates inconsistent use capitals

Reported by: rvdk Owned by:
Milestone: 2.9 Priority: normal
Severity: normal Version: 2.8.5
Component: Administration Keywords: get_page_templates
Focuses: Cc:

Description

I noticed this when using the Flutter plugin.

Somehow I did not get the templates I generated any more. For the record my template name was: Commond

I discovered that the following file/function was the problem:
/wp-admin/includes/theme.php line: 125 - 128

$themes = get_themes();
Returns an associated array with theme names in lowercase

$theme = get_current_theme();
retrieved the name with a capital C

Thus:
$templates = $themes[$theme]Template Files?;
resulted in null.

By changing line 126 to:
$theme = strtolower(get_current_theme());

I managed to solve this issue.

Please verify.

Change History (2)

comment:1 scribu4 years ago

  • Keywords reporter-feedback added; 2nd-opinion removed

You use theme and template interchangably. Was Commond a theme directory or a template file?

comment:2 scribu4 years ago

  • Keywords reporter-feedback removed
  • Milestone changed from Unassigned to 2.9
  • Resolution set to fixed
  • Status changed from new to closed

Either way, in WP 2.9 this line doesn't exist anymore:

$templates = $themes[$theme]['Template Files'];

and I can activate a theme in this directory without problems: wp-content/themes/Test

Note: See TracTickets for help on using tickets.