Ogadi FIelds
Member
Posted 2 years ago #
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.
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');
Ogadi FIelds
Member
Posted 2 years ago #
Thanks for the reply!
I just tried that, but it still didnt work. Any other ideas?
Ogadi FIelds
Member
Posted 2 years ago #
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