Alexander Kops
Forum Replies Created
Viewing 1 replies (of 1 total)
-
Forum: Plugins
In reply to: [Ultimate Category Excluder] [Plugin: Ultimate Category Excluder] OverridingI have the same problem. I solved it by altering the ksuce_exclude_categories-function to preserve the “category__not_in” settings in the query, if there are any, and just add the blocked ones:
function ksuce_exclude_categories($query) { $options = ksuce_get_options(); //Mod: Do not override existing excluded categories $categories = $query->get('category__not_in'); $array2 = empty($categories) ? array() : $categories; if ($query->is_home) { foreach ($options['exclude_main'] as $value) { $array2[] = $value; } } if ($query->is_feed) { foreach ($options['exclude_feed'] as $value) { $array2[] = $value; } } if ($query->is_archive) { if (!is_admin()) { foreach ($options['exclude_archives'] as $value) { $array2[] = $value; } } } $query->set('category__not_in', array_unique($array2)); //Mod end return $query; }So now when you use
query_posts(array('category__not_in' => array(1,2,3));
and have blocked the category ids 3,4,5 with the plugin, it will ultimately block categories 1,2,3,4,5
Viewing 1 replies (of 1 total)