[wp-trac] [WordPress Trac] #35082: get_adjacent_post() when using in term doesn't account for child terms

WordPress Trac noreply at wordpress.org
Tue Dec 22 20:52:59 UTC 2015


#35082: get_adjacent_post() when using in term doesn't account for child terms
-------------------------------------------------+-------------------------
 Reporter:  WazzaJB                              |       Owner:
     Type:  defect (bug)                         |      Status:  new
 Priority:  normal                               |   Milestone:  Future
Component:  Posts, Post Types                    |  Release
 Severity:  normal                               |     Version:  trunk
 Keywords:  has-patch has-unit-tests reporter-   |  Resolution:
  feedback                                       |     Focuses:  template
-------------------------------------------------+-------------------------
Changes (by boonebgorges):

 * keywords:  has-patch has-unit-tests => has-patch has-unit-tests reporter-
     feedback


Comment:

 Hi @WazzaJB - Thanks for the patch! Format etc looks good.

 Looking this over more closely, I'm not totally clear what we're trying to
 accomplish. Your unit test creates four posts:

 1. In 'parent' and 'child'
 2. In 'parent'
 3. In 'parent' and 'child'
 4. In 'child'

 Given this, it seems *correct* to me that each post is adjacent to its
 immediate neighbors:

 * 1 -> 2, because they're both in 'parent'
 * 2 -> 3, because they're both in 'parent'
 * 3 -> 4, because they're both in 'child'

 Your patch seems to say that only leaf nodes should be counted by
 `in_same_term`. This strikes me as incorrect. Based on your original
 ticket, I thought the problem was with posts like this:

 1. In 'child'
 2. In 'parent'
 3. In 'child'
 4. In 'parent'

 But, when I rewrite your test to test *this*, the tests pass. Which
 suggests that there may be no bug after all :)

 Can you say more about what you are trying to accomplish with the ticket?

--
Ticket URL: <https://core.trac.wordpress.org/ticket/35082#comment:5>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list