Opened 13 years ago
Closed 9 years ago
#21970 closed defect (bug) (fixed)
404 error when a post has the same slug as with a deleted (trash) page.
Reported by: |
|
Owned by: |
|
---|---|---|---|
Milestone: | 4.4 | Priority: | normal |
Severity: | normal | Version: | 3.4.2 |
Component: | Permalinks | Keywords: | 4.0-early has-patch commit |
Focuses: | Cc: |
Description
I don't know if this is a bug/issue but I'll share this anyway.
A user creates a new Page, for example, with a title "New Garden". But decides to delete it/"Move to Trash" without deleting it permanently. Then creates a new Post with the same title "New Garden". Viewing that post will result to a "404" page not found.
Attachments (6)
Change History (38)
#3
@
13 years ago
- Keywords has-patch added; needs-patch removed
Related: #21298
Perhaps get_page_by_path()
should not return trashed pages.
#6
@
12 years ago
In 21970.diff, verifying that the page has a visible post status (public, private or protected). I first thought of checking against the read_post
cap, but that might create a really confusing scenario, where a logged in user will see the page, while a logged out user will see the post.
#7
@
12 years ago
- Keywords needs-unit-tests added
21970.diff looks good to me.
21970.2.diff also handles the similar block in url_to_postid()
.
#10
@
12 years ago
21970.3.diff makes the condition syntax a bit more obvious.
#11
follow-up:
↓ 13
@
12 years ago
A similar issue happens with get_page_by_title() (pulls from trash), I may be submitting a patch for that separately as well depending on dev feedback on whether core is open to the adjustment.
#13
in reply to:
↑ 11
@
12 years ago
Replying to sc0ttkclark:
A similar issue happens with get_page_by_title() (pulls from trash)
Related: #20350
#14
@
12 years ago
- Milestone changed from 3.6 to Future Release
Punting this as we're focusing on 3.6 blockers now.
#20
@
10 years ago
Added Unit Tests.
I didn't know where to place this one so I decided for tests/post/objects.php. Now that I read it again sounds weird for me :).
This ticket was mentioned in Slack in #core by sergey. View the logs.
9 years ago
#27
@
9 years ago
- Resolution fixed deleted
- Status changed from closed to reopened
[35195] produces a unit test failure:
$ phpunit --group rewrite 1) Tests_Query_VerbosePageRules::test_post_attachment is_single, is_attachment, is_singular should be true. is_404 should be false. Failed asserting that false is true. /srv/www/wp-develop/svn/tests/phpunit/includes/testcase.php:550 /srv/www/wp-develop/svn/tests/phpunit/tests/query/conditionals.php:599
#30
@
9 years ago
- Keywords has-patch commit added; needs-unit-tests needs-patch removed
21970.4.diff fixes it for me.
Reproduced with
/%postname%/
permalink structure.