[wp-trac] [WordPress Trac] #32833: previous_post_link/next_post_link disappear when excluding by post_format
WordPress Trac
noreply at wordpress.org
Sat Aug 29 02:29:53 UTC 2015
#32833: previous_post_link/next_post_link disappear when excluding by post_format
-------------------------------------+--------------------
Reporter: markshiz | Owner:
Type: defect (bug) | Status: new
Priority: normal | Milestone: 4.4
Component: General | Version: 4.2.2
Severity: normal | Resolution:
Keywords: has-patch needs-testing | Focuses:
-------------------------------------+--------------------
Changes (by boonebgorges):
* keywords: close reporter-feedback => has-patch needs-testing
* milestone: Awaiting Review => 4.4
Comment:
Thanks for the link.
After some more digging, I managed to find a bug. I'm not 100% sure that
this is what's causing your issue, but here goes.
In [29248], the clause that handles the `$excluded_terms` param in
`get_adjacent_post()` was converted to a subquery of the form `AND p.ID
NOT IN ( SELECT ... )`, where it used to be some sort of JOIN against the
taxonomy tables. However, the `$join` and `$where` clauses were still
being set up as if the taxonomy table were still involved in the
`$excluded_terms` query.
More specifically, the query involved an `INNER JOIN` against the
`wp_term_relationships` and `wp_term_taxonomy` tables. The `INNER JOIN`
means that rows from the post table will be missed if they don't also have
at least one row in the `wp_term_relationships` table (and, in most cases,
one that matches the `$taxonomy` param). Usually, this is the case - posts
created through the normal WP interface get the category 'Uncategorized'.
But I'm betting that items in your 'project' post type don't have *any*
rows in `wp_term_relationships`. As a result, they're not being included
in the query.
Fix and unit test demonstrating the problem in [32833.diff]. markshiz, can
you please patch your installation to see if this solves the problem for
you?
--
Ticket URL: <https://core.trac.wordpress.org/ticket/32833#comment:3>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list