confirmed; it does not work (v1.5.2). in fact, it seems that the code isn’t even close to working correctly. to fix it, i’ve hacked up my installation as follows:
in file template-functions-links.php, at approximately line 221 (in function get_previous_post), you’ll see this:
$sql_exclude_cats = '';
if (!empty($excluded_categories)) {
$blah = explode('and', $excluded_categories);
foreach($blah as $category) {
$category = intval($category);
$sql_exclude_cats .= " AND post_category != $category";
}
}
i replaced that block with the following:
$sql_exclude_cats = '';
if (!empty($excluded_categories)) {
# ronr hack BEGIN
$query =
"SELECT post_id
FROM $wpdb->post2cat
WHERE category_id IN ("
. str_replace(',', ',', $excluded_categories)
. ')';
$excluded_post_rows = $wpdb->get_results($query);
if (count($excluded_post_rows) > 0) {
$sql_exclude_cats =
' AND ID NOT IN ('
. intval($excluded_post_rows[0]->post_id);
for ($i = 1; $i < (count($excluded_post_rows)); $i++) {
$sql_exclude_cats .= ',' . intval($excluded_post_rows[$i]->post_
id);
}
$sql_exclude_cats .= ')';
}
# ronr hack END
}
also did the same in get_next_post, a little farther down in the file.
my category excludes are just dandy now. i use them thus:
<?php next_post_link('%link
»', '%title', false, '15,16,17') ?>
note: my code does not do error checking, and it assumes that the parameters passed in are not screwy. <yada yada yada, other disclaimers omitted. constructive suggestions for improvements are always welcome, but please don’t bitch to me about my code; it’s provided as-is.>
presumably, this will be fixed properly in an upcoming release, so now that i’ve got it working (albeit jury-rigged), i’m not going to spend any more time on it. if it doesn’t get fixed in a future release, perhaps i’ll fold it into an asides plug-in.
anyway, good luck.
p.s., you can see the hack in action, here.