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

WordPress Trac wp-trac at lists.automattic.com
Fri Oct 5 18:21:28 UTC 2012


#22112: get_adjacent_post excluded_categories isn't excluded
-----------------------------+--------------------------
 Reporter:  PatNarciso       |       Type:  defect (bug)
   Status:  new              |   Priority:  normal
Milestone:  Awaiting Review  |  Component:  General
  Version:                   |   Severity:  normal
 Keywords:                   |
-----------------------------+--------------------------
 The category I expect to be excluded in $excluded_categories, is not
 excluded.

 With get_adjacent_post,
 Assuming $in_same_cat = TRUE
 and $excluded_categories = 'ID_OF_CATEGORY'

 $cat_array gets built with the ID's of categories it should include.
 cool.

 But, when $excluded_categories contains an ID that $cat_array contains,
 the ID is removed from the $excluded_categories by array_diff() (link-
 template.php:1155).

 So: the category I expect to be excluded in $excluded_categories, is not
 excluded.


 My resolution: I remove 1154-1157.
 if ( ! empty( $cat_array ) ) {
  $excluded_categories = array_diff($excluded_categories, $cat_array);
  $posts_in_ex_cats_sql = '';
 }

-- 
Ticket URL: <http://core.trac.wordpress.org/ticket/22112>
WordPress Trac <http://core.trac.wordpress.org/>
WordPress blogging software


More information about the wp-trac mailing list