Opened 7 years ago
Closed 9 months ago
#49294 closed defect (bug) (duplicate)
If multiple posts has same date, get_previous_post() and get_next_post() returns only first/last of them
| Reported by: | oskarijarvelin | Owned by: | |
|---|---|---|---|
| Priority: | normal | Milestone: | |
| Component: | Posts, Post Types | Version: | |
| Severity: | normal | Keywords: | |
| Cc: | Focuses: |
Description
get_previous_post() and get_next_post() both uses get_adjacent_post() -function, which uses date for query. If query return multiple posts for same date, function only returns first or last post depending on $previous -parameter. As a result, if you have multiple posts for a same date, get_previous_post() and get_next_post() functions does not work as meant to.
Found one mention about this issue about a year earlier: https://wordpress.stackexchange.com/questions/330276/get-next-post-and-get-previous-post-return-wrong-posts
Change History (5)
Note:
See TracTickets
for help on using tickets.
![(please configure the [header_logo] section in trac.ini)](/chrome/site/your_project_logo.png)
I have seen this in the Theme Unit Test data, because several posts were artificially given the same date/time. It probably does not come up much in real life to have the exact same date/time on multiple posts. But it is still very confusing when it does happen.