[wp-trac] [WordPress Trac] #32651: get_adjacent_post() doesn't return posts with the same date
WordPress Trac
noreply at wordpress.org
Wed Aug 19 20:24:11 UTC 2015
#32651: get_adjacent_post() doesn't return posts with the same date
-------------------------------+-----------------------------
Reporter: willybahuaud | Owner:
Type: defect (bug) | Status: new
Priority: normal | Milestone: Future Release
Component: Posts, Post Types | Version: 4.3
Severity: normal | Resolution:
Keywords: has-patch | Focuses: template
-------------------------------+-----------------------------
Comment (by jessedyck):
I implemented this fix using the where and sort filters (to be sure, I
also tested by making the same changes as in the diff). It has one issue -
because we're saying 'greater/less than or equal to', we don't get an end
or beginning to the pagination. We always find a post that matches 'or
equal to'.
To get around that, I'm adding 'p.ID > $post->ID' or 'p.ID < $post->ID' to
the WHERE clause instead of 'p.ID != $post->ID' so that we get a
start/finish to pagination. I don't know if that's the best method for
everyone though.
This impacted me in WooCommerce, which is probably a common scenario for
this; I used a plugin to import product data from a spreadsheet into WC,
which meant most of the post creation dates where the same.
--
Ticket URL: <https://core.trac.wordpress.org/ticket/32651#comment:5>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list