[wp-trac] [WordPress Trac] #40660: the_post_navigation not excluding terms - wp 4.7.4

WordPress Trac noreply at wordpress.org
Thu May 4 10:05:35 UTC 2017


#40660: the_post_navigation not excluding terms - wp 4.7.4
--------------------------+-----------------------------
 Reporter:  Sbaxter_Quba  |      Owner:
     Type:  defect (bug)  |     Status:  new
 Priority:  normal        |  Milestone:  Awaiting Review
Component:  General       |    Version:  4.7.4
 Severity:  normal        |   Keywords:
  Focuses:                |
--------------------------+-----------------------------
 I'm retrieving the post navigation as so

  {{{#!php
 <?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.

--
Ticket URL: <https://core.trac.wordpress.org/ticket/40660>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list