WordPress.org

Support

Support » Plugins and Hacks » delete a category from the sidebar

delete a category from the sidebar

  • sidebar have this html:

    <h2>Categories</h2>
    <ul>
    <li><a href="http://localhost/wordpress-it_IT-2.2.1/category/categ_new/"
    >categ_new</a>
    </li>
    <li><a href="http://localhost/wordpress-it_IT-2.2.1/category/my_category/"
    >my_category</a>
    </li>
    </ul>

    I tried with this code:

    function foo_bar($content, $category = null) {
      if($category->cat_name!='my_category') return $content;
    }
    add_filter('list_cats', foo_bar, 10, 2);

    but I get:

    <h2>Categories</h2>
    <ul>
    <li><a href="http://localhost/wordpress-it_IT-2.2.1/category/categ_new/"
    >categ_new</a>
    </li>
    <li><a href="http://localhost/wordpress-it_IT-2.2.1/category//"
    ></a>
    </li>
    </ul>

    I’v used this plugin too: http://djz.hu/blog/posts/372
    but i still see the category in sidebar

Viewing 1 replies (of 1 total)
  • Doodlebee

    @doodlebee

    Why don’t you just use “wp_list_categories()”? You can exclude any category you want with that built-in tag.

Viewing 1 replies (of 1 total)
  • The topic ‘delete a category from the sidebar’ is closed to new replies.