[wp-trac] [WordPress Trac] #33017: Unattached images displayed with page.php instead of index.php

WordPress Trac noreply at wordpress.org
Fri Jul 17 20:59:15 UTC 2015


#33017: Unattached images displayed with page.php instead of index.php
--------------------------+------------------------------
 Reporter:  creon         |       Owner:
     Type:  defect (bug)  |      Status:  new
 Priority:  normal        |   Milestone:  Awaiting Review
Component:  Themes        |     Version:  4.2.2
 Severity:  normal        |  Resolution:
 Keywords:                |     Focuses:  template
--------------------------+------------------------------
Changes (by creon):

 * keywords:  reporter-feedback =>


Comment:

 It looks like there is no difference when I switch to a 'Latest Posts'
 front page and back to a static one. However, it turns out the image is
 actually ''attached''. I was not aware that when you insert an unattached
 image into a post, the post the image was inserted into becomes the
 image's new parent (at least, looking at the 'post_parent' property via
 the 'Debug This' plugin). The image I thought was unattached was actually
 attached to a page.

 When I deactivate all plugins and switch to a copy of twentyfifteen 1.2
 (with image.php  and single.php deleted), the behavior is the same.

 In both scenarios, there is no problem when the image is attached to a
 post, it is just when the image is attached to a page that the 'attachment
 page' uses page.php. Looking back at the template hierarchy, I suppose it
 is not 'unexpected behavior', but I thought attachments would get the same
 template logic regardless of their post_parent post type.

--
Ticket URL: <https://core.trac.wordpress.org/ticket/33017#comment:2>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list