Changing default categories

As I couldn’t find a plugin to automatically assign a (different) default category for “guest” users, I’ve had to do a little hacking.

I’ve added a little to the wp-admin/admin-functions.php file, all in the get_nested_categories() function.

function get_nested_categories($default = 0, $parent = 0) {
global $post_ID, $mode, $wpdb, $userdata;

get_currentuserinfo();
if ($post_ID) {

and have replaced:

} else {
$checked_categories[] = $default;
}

with

} else {
if ($userdata->ID == 1) { // If it’s me
$checked_categories[] = $default;
} else {
$checked_categories[] = 5; // The category number for “Guest posts”
}

}

All I have to do now, of course, is remember I’ve done this the next time there’s an update!

 

One response


  1. I wish I understood.

    Em3: Ah, but the whole point is that you don’t now have to, your Eminence.

Leave a Reply