[wp-trac] [WordPress Trac] #53928: Media Attachment Pages Break (404) when Elementor is Activated

WordPress Trac noreply at wordpress.org
Tue Aug 17 06:21:49 UTC 2021


#53928: Media Attachment Pages Break (404) when Elementor is Activated
--------------------------+----------------------
 Reporter:  pracko        |       Owner:  (none)
     Type:  defect (bug)  |      Status:  closed
 Priority:  normal        |   Milestone:
Component:  Media         |     Version:
 Severity:  normal        |  Resolution:  invalid
 Keywords:                |     Focuses:
--------------------------+----------------------
Changes (by peterwilsoncc):

 * keywords:  reporter-feedback =>
 * status:  new => closed
 * resolution:   => invalid
 * milestone:  Awaiting Review =>


Comment:

 Thanks for the additional information.

 I've tested this each major release of WordPress since 5.4 and with the
 latest version of Elementor the file not found error for unattached images
 happens in each version of WP.

 I think your issue is plugin rather than WordPress related.

 As such, I am going to close this ticket off as ''invalid''. In this case,
 that's trac's really unfriendly term for the problem is likely to be
 happening in other software. Feel free to post any follow up comments on
 this ticket, I'll still get notified even with the ticket closed.

 ----

 Testing notes:

 Starting point for each test is:

 1) Permalinks set to `%postname`
 2) Plugins enabled: query-monitor, elementor
 3) PHP version: 7.4

 Uploading directly to media library

 1) Go to WP Admin > Media Library
 2) Upload an image: Image from iOS.jpg
 3) Click image, attachment page is `/image-from-ios/`
 4) Visit `/image-from-ios` receive 404 error
 5) Disable plugin
 6) Reload `/image-from-ios` and page shows as expected

 Uploading via post

 1) Go to WP Admin > Posts > Edit Hello World
 2) Create an image block
 3) Upload image to image block: Image from iOS.jpg
 4) Go to media library
 5) Click image, attachment page is `/hello-world/image-from-ios/`
 6) Visit `/hello-world/image-from-ios/`, image shows as expected
 7) Delete Hello World Post
 8) Go to media library
 9) Click image, attachment page is `/?attachment_id=5`
 10) Visit `/?attachment_id=5`, 404 error
 11) Disable plugin
 12) Visit `/?attachment_id=5`, image shows as expected

 As the file not found errors were occurring back to WP 5.4 (well before
 the last set of changes to the permalink function), I think it's something
 in the plugin but I am not sure what. I see it does filter media
 permalinks.

 > Ideally, Media Attachment page URLs should be created once and never
 change since the change leads to a 404.

 In most cases the URLs remain unchanged but for media uploaded to a post
 the URL is `/post-slug/media-file-slug`. If the post is subsequently
 trashed or deleted then the media URL changes as `/post-slug/` no longer
 exists for the media to live under.

 #52373 is about what to do with attachment URLs when the post is deleted,
 feel free to add some thoughts there.

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


More information about the wp-trac mailing list