Ultimate Category Excluder
Overriding (3 posts)

  1. jxxst
    Posted 4 years ago #

    I would like to list some posts from a category calles "Top10" in my sidebar. These are automatically imported each day and should not be displayed in the "normal" front page loop. However, when I try all the plugins available they remove the posts not from the normal loop but also from my "custom loop". Is their any way to override the setting in the plugin?

    Any help is appreciated!


  2. Michael Clark
    Posted 4 years ago #

    How are you adding the "Top10" category to your sidebar? You may be able to hard code a WordPress query into the sidebar to generate the listing. Read through this page http://www.kimwoodbridge.com/wordpress-how-to-list-recent-posts-from-one-category/ for tips on how to get started. I don't know if this will conflict with UCE or other category management plugins. I hope this helps. Mike

  3. Alexander Kops
    Posted 3 years ago #

    I 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

Topic Closed

This topic has been closed to new replies.

About this Plugin

  • Ultimate Category Excluder
  • Frequently Asked Questions
  • Support Threads
  • Reviews

About this Topic