Make WordPress Core

Opened 5 years ago

Closed 5 years ago

#50199 closed defect (bug) (fixed)

Theme Editor: Remove unused $has_templates boolean

Reported by: sergeybiryukov's profile SergeyBiryukov Owned by: sergeybiryukov's profile SergeyBiryukov
Milestone: 5.5 Priority: normal
Severity: trivial Version:
Component: Themes Keywords: needs-patch good-first-bug
Focuses: administration Cc:

Description

In wp-admin/theme-editor.php, the $has_templates boolean is a remnant from when the Theme Editor still had the "Templates" heading and is unused in the current logic.

Some history:

  • [20315]: $has_templates introduced.
  • [35180]: $has_templates moved around.
  • [41851]: "Templates" heading removed.
  • [42155]: $has_templates made redundant by && $theme->parent().

Attachments (1)

50199.diff (1.0 KB) - added by dboy1988 5 years ago.

Download all attachments as: .zip

Change History (3)

#1 @dboy1988
5 years ago

Hi,

I am not sure that is right.

On line 77: $has_templates = false is declared.

On line 85: if $allowed_files is not empty, $has_templates will be set to true.

Then down on line 254: if the theme is a child theme, it uses that boolean value to decide if the message, This child theme inherits templates from a parent theme (Parent theme name)

To me it seems like it is still required?

Please let me know if I am wrong.

Thanks

Version 0, edited 5 years ago by dboy1988 (next)

@dboy1988
5 years ago

#2 @SergeyBiryukov
5 years ago

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

In 47844:

Theme Editor: Remove unused $has_templates boolean.

The variable is a remnant from when the Theme Editor still had the "Templates" heading and is unused in the current logic.

The condition it was a part of would always evaluate to true for a child theme, regardless of the $has_templates value.

Props dboy1988.
Fixes #50199.

Note: See TracTickets for help on using tickets.