Monthly Archives: February, 2011

WordPress 3.1 is Out

The latest, greatest version of WordPress was released yesterday. It comes with a whole lot fixes and new features. One of those new features is an admin bar similar to the one used on WordPress.com; however the admin bar only includes specific links rather than being automatically populated with all the various links that my install of WordPress has (from various plugins). I found the lack of those links for one particular plugin particularly annoying. A quick bit of research and a little bit later, I developed the Now-Reading Admin Bar Menu plugin.

I also noticed after the update that one of my client sites wasn’t working correctly. It turns out there’s a bug in WordPress 3.1 which breaks category exclusion. On my client’s site, I was using this code:

function exclude_category($query) {
$cat_id = '-'.get_cat_id('meetings');
if ( $query->is_home ) {
$query->set('cat', $cat_id);
}
return $query;
}
add_filter('pre_get_posts', 'exclude_category');

Fortunately that bug I linked to also includes a workaround. By changing the above bit of code to read as follows, I was able to fix my client’s site. ^_^

function exclude_category($query) {
$cat_id = '-'.get_cat_id('meetings');
if ( $query->is_home ) {
$query->set('category__not_in', array($cat_id));
}
return $query;
}
add_filter('pre_get_posts', 'exclude_category');

Copyright © 2004 – 2018 CoffeeBear.net. Powered by WordPress.