WordPress.org

Make WordPress Core

Opened 2 weeks ago

Closed 11 days ago

#51776 closed defect (bug) (fixed)

Attachement page for private post type is a 404.

Reported by: Toro_Unit Owned by: peterwilsoncc
Milestone: 5.6 Priority: normal
Severity: normal Version: 5.6
Component: Permalinks Keywords: has-patch has-unit-tests
Focuses: Cc:

Description

  1. Create Private post type.
  2. Create post at the post type.
  3. Upload image in the post.
  4. See attachment page.
  5. 404 the attachment page.

It occurs in 5.6-beta4.
Does not occur in 5.6-beta3.

related #5272 ?

Change History (10)

#1 @johnbillion
13 days ago

  • Milestone changed from Awaiting Review to 5.6

This ticket was mentioned in Slack in #core by hellofromtonya. View the logs.


12 days ago

#3 @peterwilsoncc
12 days ago

  • Owner set to peterwilsoncc
  • Status changed from new to assigned

@Toro_Unit thank you for the report, I've self assigned this to take a look.

To assist with reproducing the problem, when you get a 404 on the attachment page are you logged in as a user with access to the private post?

Thanks

This ticket was mentioned in PR #745 on WordPress/wordpress-develop by peterwilsoncc.


12 days ago

  • Keywords has-patch has-unit-tests added

https://core.trac.wordpress.org/ticket/51776

Starting with some unit tests -- they fail.

#5 @Toro_Unit
12 days ago

@peterwilsoncc

To assist with reproducing the problem, when you get a 404 on the attachment page are you logged in as a user with access to the private post?

Yes, Whether logged in or not, get a 404.

Thanks.

#6 @peterwilsoncc
12 days ago

Thanks boss, much appreciated!

You're correct, the issue comes from #5272. The use of get_post_status() in the new check in redirect_canonical() is causing part of the issue but I am still to get my full notes worked out on the issue. I will drop them here once I have them.

This ticket was mentioned in Slack in #core by hellofromtonya. View the logs.


11 days ago

This ticket was mentioned in Slack in #core by peterwilsoncc. View the logs.


11 days ago

#9 @peterwilsoncc
11 days ago

Having discussed this with @helen, I am going to largely revert the changes for #5272 as RC1 is due quite soon.

The patch is in the pull request https://github.com/WordPress/wordpress-develop/pull/745

#10 @peterwilsoncc
11 days ago

  • Resolution set to fixed
  • Status changed from assigned to closed

In 49622:

Permalinks: Prevent attachment pages 404ing following [49563].

This largely reverts [49563] due to attachment pages returning 404: File not found errors when they use the inherit status.

Permalink changes to attachment pages are retained when they are descendants of trashed or deleted posts.

Props Toro_Unit, helen, johnbillion, peterwilsoncc.
Fixes #51776.
See #5272.

Note: See TracTickets for help on using tickets.