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

WordPress Trac noreply at wordpress.org
Tue Aug 17 02:47:12 UTC 2021


#53928: Media Attachment Pages Break (404) when Elementor is Activated
-------------------------------+------------------------------
 Reporter:  pracko             |       Owner:  (none)
     Type:  defect (bug)       |      Status:  new
 Priority:  normal             |   Milestone:  Awaiting Review
Component:  Media              |     Version:
 Severity:  normal             |  Resolution:
 Keywords:  reporter-feedback  |     Focuses:
-------------------------------+------------------------------

Comment (by pracko):

 > Are you able to check if this started happening in WordPress 5.7?

 I am not really sure when this began happening, but I did roll back WP to
 5.5.5 and Elementor to v 3.2.5 and the issue persisted for all unattached
 media *except* when Permalinks were set to 'Plain'

 > In the commit [50132] some changes were made to `get_attachment_link()`
 to prevent WordPress returning links that would 404 for attachments in
 some circumstances, for full details see ticket #52373.

 This could have something to do with it, but I am not sure.

 > As the bug is only apparent with a plugin installed, it's possible the
 issue is caused by the plugin but it would be good to confirm the change
 in WordPress wasn't a contributing factor.

 Definitely is related to Elementor as I did a fresh test install, see
 below...  But again, their support claims they cannot replicate the issue.
 I am bringing it up here in the event someone can identify what possible
 changes in core could be causing this relative to Elementor.

 > As this is only happening with a plugin enabled, I've reduced the
 severity of the issue. I've also removed the version as it's used to
 indicate when the bug was introduced and it's unlikely to be 5.8 as that
 wasn't released until late July.

 Yes, this most likely began sometime in June/July during WP 5.7.x

 To rule out previously installed plugins and themes from testing, I
 created a fresh testing environment:

 1) WP 5.8
 2) 2021 Theme
 3) No add'l plugins installed
 4) Permalinks setting: Post Name
 5) Create New Post: Test @ /test and add inline image tahoe.webp
 6) MA page for tahoe.webp works @ /test/tahoe/
 7) Create 2nd Post: Test @ /test-2 and add inline image coins-512.png
 8) MA page for coins-512.png works @ /test-2/coins-512/
 9) Permanently delete /test-2
 10) In Media Library, URL for coins-512.png is now changed to /coins-512/
 11) MA page for coins-512.png still works but now is @ /coins-512/
 12) Install Elementor v 3.4.0
 13) Refresh MA page /coins-512/ and now a 404 error is generated!
 14) Refresh MA page /test/tahoe/ and this MA page still works (is still
 attached to /test)
 15) Set Permalinks to 'Plain'
 16) Refresh Media Library
 17) URL to MA page for coins-512.png has now changed to /?attachment_id=9
 18) The MA page at /?attachment_id=9 is now visible again
 19) Deactivate Elementor
 20) Refresh page @ /?attachment_id=9 and it is still visible at the new
 URL
 21) MA page for tahoe.webp has been changed to /?attachment_id=6 and is
 also visible

 So the issue involves changes that occur to the URL of Media Attachment
 pages when they are detached from a post either manually or as a result of
 the permanent deletion of a post *when* Elementor is installed and *when*
 permalinks are set to anything other than 'Plain'. Plain eliminates this
 problem I think due to the query component present in the URL of the MA
 page.

 This is why I believe WP core has something to do with it.

 Hopefully others are able to replicate this issue and test further.

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

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


More information about the wp-trac mailing list