[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:25:54 UTC 2012
#22112: get_adjacent_post excluded_categories isn't excluded
--------------------------+------------------------------
Reporter: PatNarciso | Owner:
Type: defect (bug) | Status: new
Priority: normal | Milestone: Awaiting Review
Component: Template | Version:
Severity: normal | Resolution:
Keywords: |
--------------------------+------------------------------
Changes (by SergeyBiryukov):
* component: General => Template
Old description:
> 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 = '';
> }
New description:
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#comment:1>
WordPress Trac <http://core.trac.wordpress.org/>
WordPress blogging software
More information about the wp-trac
mailing list