WordPress.org

Make WordPress Core

Opened 6 years ago

Closed 6 years ago

Last modified 6 years ago

#9266 closed defect (bug) (invalid)

Filename conflict between media/attachment and Page template names

Reported by: martinredfern Owned by:
Milestone: Priority: low
Severity: minor Version: 2.7.1
Component: Upload Keywords: reporter-feedback
Focuses: Cc:

Description

If an attachment is uploaded with the same name as a Page template, the previously-defined link between a Page and the Page template of that name is somehow broken.

The consequence is that the Page is then displayed using the default template, as per the template hierarchy, even though the named Page template exists and is correctly linked to the Page under 'attributes' in the admin panel.

Obviously this can be avoided by using distinct names for uploads/attachments and Page templates, but this seems an unnecessary inconvenience to add to the theme system learning curve.

Moreover, I was unable to find anything on the support forum referring to this issue.

It seems to me that the cause of the problem is something to do with the way the database handles attachments, and that it might be possible to distinguish between an attachment, which typically has a file extension such as .pdf/.jpg/.png/.gif etc and a Page template name, which is very unlikely to have such an extension to its name.

Perhaps not so much a big fix as a low-priority finesse?!

Change History (3)

comment:1 @DD326 years ago

  • Keywords reporter-feedback added; attachment upload media Page_template_name filename_conflict removed

suggest closing: Worksforme

I have a template "template-tool-css-expander.php"

<?php
/*
Template Name: Tools: CSS Expander
*/

After Uploading that same file via the media uploader, the page still has the page template selected and applied.

Could you give an example case?

comment:2 @Denis-de-Bernardy6 years ago

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

+1 to that. invalid even. might you be using a plugin? templates are not stored in the DB. please reopen with feedback.

comment:3 @Denis-de-Bernardy6 years ago

  • Milestone Unassigned deleted
Note: See TracTickets for help on using tickets.