Opened 10 years ago
Closed 10 years ago
#30287 closed enhancement (fixed)
Private posts skipped in single post navigation
Reported by: | blogan | Owned by: | boonebgorges |
---|---|---|---|
Milestone: | 4.2 | Priority: | normal |
Severity: | normal | Version: | 1.5 |
Component: | Posts, Post Types | Keywords: | good-first-bug has-patch |
Focuses: | Cc: |
Description
A private post that appears on my main page when logged in does not appear in the next/previous navigation of a single post.
Attachments (2)
Change History (8)
#2
@
10 years ago
- Component changed from General to Posts, Post Types
- Keywords needs-patch needs-unit-tests good-first-bug added
- Milestone changed from Awaiting Review to Future Release
- Type changed from defect (bug) to enhancement
- Version changed from trunk to 1.5
The issue is with the query in the get_adjacent_post() functions that only allows for published posts.
Correct. The post_status = 'publish'
clause has been hardcoded since at least 1.5. See [1557].
I don't know if it's as straight forward as that because there's no logged in check and I'm fairly certain we don't want to run this altered query for every user.
It definitely is not this straightforward, for these very reasons :) The purpose of the 'private' post status is to hide a post from all members but the author of the post. WP_Query
accounts for this, but get_adjacent_post()
does not use WP_Query
(see #26937). I suppose mirroring the logic here too would be fine, but I'd like to see a patch + unit tests.
#3
@
10 years ago
- Keywords has-patch added; needs-patch needs-unit-tests removed
Patch and unit tests added to include private posts in get_adjacent_post
The issue is with the query in the
get_adjacent_post()
functions that only allows for published posts.Changing it to the following could solve this, but I don't know if it's as straight forward as that because there's no logged in check and I'm fairly certain we don't want to run this altered query for every user.