[wp-trac] [WordPress Trac] #22112: get_adjacent_post excluded_categories isn't excluded

WordPress Trac noreply at wordpress.org
Thu May 29 15:04:30 UTC 2014


#22112: get_adjacent_post excluded_categories isn't excluded
------------------------------------------------+-----------------------
 Reporter:  PatNarciso                          |       Owner:
     Type:  defect (bug)                        |      Status:  new
 Priority:  normal                              |   Milestone:  4.0
Component:  Posts, Post Types                   |     Version:  3.8.1
 Severity:  normal                              |  Resolution:
 Keywords:  2nd-opinion has-patch dev-feedback  |     Focuses:  template
------------------------------------------------+-----------------------

Comment (by kovshenin):

 Hi! I think the query for exclusion is wrong here. The regular NOT IN (5)
 will look for at least one row that doesn't match 5, and it'll find plenty
 if the post has more than one category even if there's a 5. I think we
 should be reversing this in a subquery, like we do with tax queries. Took
 a stab in [attachment:22112.diff].

 @jessepollak fyi the unit tests in your patch use wp_set_object_terms with
 append=false, which means every next call on the same object will
 overwrite the previous set of categories, rather than append.

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


More information about the wp-trac mailing list