The-SEO-Framework-Extension-Manager icon indicating copy to clipboard operation
The-SEO-Framework-Extension-Manager copied to clipboard

Origin: unattached uploads get redirected to /wp-admin

Open skyminds opened this issue 5 years ago • 1 comments

Describe the bug Hi,

When Origin is enabled, uploads that are not attached to a post/page get redirected to /wp-admin, instead of displaying the current attachment.

To Reproduce Steps to reproduce the behavior:

  1. Activate Origin
  2. curl -I [attachment_page]
  3. Results:

HTTP/2 301 date: Sun, 26 Jan 2020 22:28:35 GMT content-type: text/html; charset=UTF-8 set-cookie: __cfduid=d1728297f51b5477515a75e7f87906d451580077715; expires=Tue, 25-Feb-20 22:28:35 GMT; path=/; domain=.example.com; HttpOnly; SameSite=Lax; Secure expires: Sun, 26 Jan 2020 23:28:06 GMT cache-control: max-age=3600 x-redirect-by: WordPress location: https://www.example.com/wp-admin/

  1. See error

Expected behavior The attachment page should redirect to the attachment itself.

Thank you, Matt

skyminds avatar Jan 26 '20 22:01 skyminds

Hi Matt,

I'm afraid I couldn't reproduce this issue myself. So, I believe there's another plugin interfering and rewriting the URLs on a low level. Most likely, an image-optimization, security, or CDN tool.

Given your expertise using the CLI, I don't think you'll have trouble browsing through the active plugins' and theme's code.

I recommend you look for the plugin or theme that hooks into this filter: wp_get_attachment_url. Alternatively, look for filters get_the_guid, upload_dir, *_option_upload_path (* is a wildcard), or get___wp_attached_file_metadata—might they be altered.

See if deactivating the resulting plugin or theme helps pinpoint the core of the issue. Please let me know which it is—might anything come up. Thank you!

This is the active code in Cord affected by this issue, where $post is the current attachment: https://github.com/sybrew/The-SEO-Framework-Extension-Manager/blob/c51caa805117ef9d5585e72a3ee2b1cb57ff3d03/extensions/free/origin/trunk/origin.php#L57-L61

sybrew avatar Jan 28 '20 01:01 sybrew