WordPress.org

Make WordPress Core

Opened 2 years ago

Closed 5 months ago

#22145 closed enhancement (wontfix)

Add warning when duplicate page Template Names are present

Reported by: johncoswell Owned by:
Milestone: Priority: normal
Severity: trivial Version:
Component: Themes Keywords:
Focuses: template Cc:

Description

Currently, there's no way without searching through every template file whether or not you have a duplicate Template Name (from, say, copying a page template file to another one). It would be nice to have a warning in the Page Template selection area that you have duplicate Template Names in certain files, and to direct you to repair that error before you proceed with setting Page Templates.

Change History (5)

comment:1 @SergeyBiryukov2 years ago

  • Component changed from Editor to Template

comment:2 @nacin13 months ago

  • Component changed from Template to Themes
  • Focuses template added

comment:3 follow-up: @RDall12 months ago

While I do like this idea aren't most themes are produced by people with FTP/SSH access. Wouldn't they see the template names in the list of templates file before they went into set the template in the page editor.

We would also give the user control to change file names which might be too much control for the user IMHO.

comment:4 in reply to: ↑ 3 @terminalpixel5 months ago

Replying to RDall:

They would see the PHP file names not the template name which is included in a comment in a file.

But I agree this would mainly be for developers so perhaps it could check for WP_DEBUG being set.

While I do like this idea aren't most themes are produced by people with FTP/SSH access. Wouldn't they see the template names in the list of templates file before they went into set the template in the page editor.

We would also give the user control to change file names which might be too much control for the user IMHO.

comment:5 @obenland5 months ago

  • Milestone Awaiting Review deleted
  • Resolution set to wontfix
  • Status changed from new to closed

This sounds like an edge case situation, the overwhelming majority of themes probably doesn't have more than a handful of page templates, if any.

I'd consider it plugin territory since it's a debug notification used during development, and not intended for users. Maybe it could be part of Theme Check.

Note: See TracTickets for help on using tickets.