[wp-trac] [WordPress Trac] #20612: Cannot access Page if an existing Media item has the same name/slug

WordPress Trac wp-trac at lists.automattic.com
Fri May 4 05:42:51 UTC 2012


#20612: Cannot access Page if an existing Media item has the same name/slug
--------------------------+-----------------------------
 Reporter:  batmoo        |      Owner:
     Type:  defect (bug)  |     Status:  new
 Priority:  normal        |  Milestone:  Awaiting Review
Component:  General       |    Version:
 Severity:  normal        |   Keywords:
--------------------------+-----------------------------
 When using pretty permalinks, an existing media item with the same slug as
 a page will override access to that page.

 Steps to reproduce, from the Dashboard:

 # Media > Add New (rename any image to test.png and upload)
 # You can view the media item at {{{/test/}}}
 # Pages > Add New (Set "Test" as the title and pubish)
 # Viewing the published page (also {{{/test/}}}) will show you the media
 item.

 The page added in the last step 3 has the same slug as the media item.
 Clicking on "View Page" will show you the media item. Even the unpretty
 permalink does not work: {{{?pagename=test}}}

 The query generated by WordPress looks for both pages and attachments,
 which is why this conflict happens:

 {{{SELECT ID, post_name, post_parent FROM vip_posts WHERE post_name IN
 ('test') AND (post_type = 'page' OR post_type = 'attachment')}}}

 There should be some sort of constraint that prevents this.

-- 
Ticket URL: <http://core.trac.wordpress.org/ticket/20612>
WordPress Trac <http://core.trac.wordpress.org/>
WordPress blogging software


More information about the wp-trac mailing list