Opened 7 years ago
Last modified 4 years ago
#40660 new defect (bug)
the_post_navigation not excluding terms - wp 4.7.4
Reported by: | Sbaxter_Quba | Owned by: | |
---|---|---|---|
Milestone: | Awaiting Review | Priority: | normal |
Severity: | normal | Version: | 4.7.4 |
Component: | Query | Keywords: | needs-testing |
Focuses: | Cc: |
Description
I'm retrieving the post navigation as so
<?php $args = array( 'in_same_term' => true, 'excluded_terms' => '129', 'taxonomy' => 'category' ); the_post_navigation( $args )
I've debugged and it constructs the $where clause here as it should (properly excluding the term) https://github.com/WordPress/WordPress/blob/master/wp-includes/link-template.php#L1647
$where = AND tt.taxonomy = 'category' AND tt.term_id IN (127) AND p.ID NOT IN ( SELECT tr.object_id FROM wp_term_relationships tr LEFT JOIN wp_term_taxonomy tt ON (tr.term_taxonomy_id = tt.term_taxonomy_id) WHERE tt.term_id IN (129) ) AND ( p.post_status = 'publish' OR p.post_status = 'private' )
This is then replaced here https://github.com/WordPress/WordPress/blob/master/wp-includes/link-template.php#L1716 it improperly constructs the where clause so that the result is as follows
$where = WHERE p.menu_order > '2' AND p.post_type = 'post' AND p.post_status = 'publish'
This means i cannot excluded other categories from the post navigation or specify which categories to exclude.
Change History (2)
Note: See
TracTickets for help on using
tickets.