Opened 9 months ago
Last modified 9 months ago
#22112 new defect (bug)
get_adjacent_post excluded_categories isn't excluded — at Version 1
| Reported by: |
|
Owned by: | |
|---|---|---|---|
| Priority: | normal | Milestone: | Awaiting Review |
| Component: | Template | Version: | |
| Severity: | normal | Keywords: | |
| Cc: |
Description (last modified by SergeyBiryukov)
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 = '';
}
Change History (1)
comment:1
SergeyBiryukov
— 9 months ago
- Component changed from General to Template
- Description modified (diff)