Exclude Categories not working properly
-
I have been trying to exclude “uncategorized” from my list of posts. (who would’t?) And nothing has been working. Also, noticed there are several others that experienced the same problem … with no response from the author. So I dug into the code and got lucky.
On line 379 of collapscatlist.php, there is a for-loop
for ($i=0; $i<count($categories); $i++) { if ($inExclude=='exclude' && !empty($inExclusionArray)) { if (in_array($categories[$i]->slug, $inExclusionArray) OR in_array($categories[$i]->term_id, $inExclusionArray)) { unset($categories[$i]); } } }
The problem is that the array actually runs from 1 to count, so the last element is always overlooked.
Changing the for-loop limits fixes the problem
for ($i=1; $i<=count($categories); $i++)
Aside from this one bug, its a terrific plugin … and I never would have found the bug if wasn’t so well written. Thanks!
https://www.ads-software.com/plugins/collapsing-categories/
Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)
- The topic ‘Exclude Categories not working properly’ is closed to new replies.