diff --git a/wp-admin/admin-functions.php b/wp-admin/admin-functions.php index 48873785ec80..0168f5a1d8e1 100644 --- a/wp-admin/admin-functions.php +++ b/wp-admin/admin-functions.php @@ -19,19 +19,19 @@ function checked($checked, $current) { } function get_nested_categories($default = 0) { - global $post_ID, $tablecategories, $tablepost2cat, $mode, $wpdb; + global $post_ID, $mode, $wpdb; if ($post_ID) { $checked_categories = $wpdb->get_col(" SELECT category_id - FROM $tablecategories, $tablepost2cat - WHERE $tablepost2cat.category_id = cat_ID AND $tablepost2cat.post_id = '$post_ID' + FROM $wpdb->categories, $wpdb->post2cat + WHERE $wpdb->post2cat.category_id = cat_ID AND $wpdb->post2cat.post_id = '$post_ID' "); } else { $checked_categories[] = $default; } - $categories = $wpdb->get_results("SELECT * FROM $tablecategories ORDER BY category_parent DESC, cat_name ASC"); + $categories = $wpdb->get_results("SELECT * FROM $wpdb->categories ORDER BY category_parent DESC, cat_name ASC"); $result = array(); foreach($categories as $category) { $array_category = get_object_vars($category); @@ -66,14 +66,14 @@ function dropdown_categories($default = 0) { // Dandy new recursive multiple category stuff. function cat_rows($parent = 0, $level = 0, $categories = 0) { - global $wpdb, $tablecategories, $tablepost2cat, $bgcolor; + global $wpdb, $bgcolor; if (!$categories) { - $categories = $wpdb->get_results("SELECT * FROM $tablecategories ORDER BY cat_name"); + $categories = $wpdb->get_results("SELECT * FROM $wpdb->categories ORDER BY cat_name"); } if ($categories) { foreach ($categories as $category) { if ($category->category_parent == $parent) { - $count = $wpdb->get_var("SELECT COUNT(post_id) FROM $tablepost2cat WHERE category_id = $category->cat_ID"); + $count = $wpdb->get_var("SELECT COUNT(post_id) FROM $wpdb->post2cat WHERE category_id = $category->cat_ID"); $pad = str_repeat('— ', $level); $bgcolor = ('#eee' == $bgcolor) ? 'none' : '#eee'; @@ -91,13 +91,13 @@ function cat_rows($parent = 0, $level = 0, $categories = 0) { } function wp_dropdown_cats($currentcat, $currentparent = 0, $parent = 0, $level = 0, $categories = 0) { - global $wpdb, $tablecategories, $tablepost2cat, $bgcolor; + global $wpdb, $bgcolor; if (!$categories) { - $categories = $wpdb->get_results("SELECT * FROM $tablecategories ORDER BY cat_name"); + $categories = $wpdb->get_results("SELECT * FROM $wpdb->categories ORDER BY cat_name"); } if ($categories) { foreach ($categories as $category) { if ($currentcat != $category->cat_ID && $parent == $category->category_parent) { - $count = $wpdb->get_var("SELECT COUNT(post_id) FROM $tablepost2cat WHERE category_id = $category->cat_ID"); + $count = $wpdb->get_var("SELECT COUNT(post_id) FROM $wpdb->post2cat WHERE category_id = $category->cat_ID"); $pad = str_repeat('– ', $level); echo "\n\t