function fwp_category_checklist($post_id = 0, $descendents_and_self = 0, $selected_cats = false) { if (function_exists('wp_category_checklist')) { wp_category_checklist($post_id, $descendents_and_self, $selected_cats); } else { // selected_cats is an array of integer cat_IDs / term_ids for // the categories that should be checked global $post_ID; $cats = get_nested_categories(); // Undo damage from usort() in WP 2.0 $dogs = array(); foreach ($cats as $cat) { $dogs[$cat['cat_ID']] = $cat; } foreach ($selected_cats as $cat_id) { $dogs[$cat_id]['checked'] = true; } write_nested_categories($dogs); } }
function dropdown_categories($default = 0) { write_nested_categories(get_nested_categories($default)); }