WordPress.org

Support

Support » How-To and Troubleshooting » Excluding categories…code, plugin, nothing works

Excluding categories…code, plugin, nothing works

  • Hi all…

    I recently upgraded to wordpress 3.1.1, and it seems that the ability to exclude categories from the homepage (by adding code to functions.php) doesnt work for me anymore. It worked in 3.1 (after using the plugin hotfix). The code i used is as follows:

    http://pastebin.com/vP7mXDKg

    I have tried the Ultimate Category Excluder plugin, and that didnt work. I have tried deactivating all plugins and switching to the default theme, and that didnt work either…

    Any ideas?

    Thanks in advance.

Viewing 3 replies - 1 through 3 (of 3 total)
  • Moderator Michael

    @alchymyth

    Forum Moderator

    category__not_in would use an array of category ids – not a string with a list of negative ids

    try:

    function exclude_category($query) {
    if ( $query->is_home ) {
    $query->set('category__not_in', array(6, 9));
    }
    return $query;
    }
    add_filter('pre_get_posts', 'exclude_category');

    Thanks for the reply!

    I just tried that, but it still didnt work. Any other ideas?

    any help or idea of what the problem could be? I tried deactivating all the plugins and changing to the default theme again, cleared cache, etc, but no luck…like i said, it all worked just before i upgraded to 3.1.1

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Excluding categories…code, plugin, nothing works’ is closed to new replies.