From 65e4ddc684533a0d0618a58e3dcaf0459a598e74 Mon Sep 17 00:00:00 2001 From: ryan Date: Fri, 18 Apr 2008 18:12:04 +0000 Subject: [PATCH] Don't query post cats if no post. see #2621 git-svn-id: http://svn.automattic.com/wordpress/trunk@7739 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- wp-admin/edit-form-advanced.php | 2 +- wp-admin/includes/template.php | 8 ++++++-- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/wp-admin/edit-form-advanced.php b/wp-admin/edit-form-advanced.php index 00fc5f8f2c..96776d4e3e 100644 --- a/wp-admin/edit-form-advanced.php +++ b/wp-admin/edit-form-advanced.php @@ -241,7 +241,7 @@ endif; ?>
diff --git a/wp-admin/includes/template.php b/wp-admin/includes/template.php index 71b4ec2556..7ed2d03d9d 100644 --- a/wp-admin/includes/template.php +++ b/wp-admin/includes/template.php @@ -156,11 +156,15 @@ class Walker_Category_Checklist extends Walker { } } -function wp_category_checklist( $post_id ) { +function wp_category_checklist( $post_id = 0 ) { $walker = new Walker_Category_Checklist; $args = array(); - $args['selected_cats'] = wp_get_post_categories($post_id); + + if ( $post_id ) + $args['selected_cats'] = wp_get_post_categories($post_id); + else + $args['selected_cats'] = array(); $args['popular_cats'] = get_terms( 'category', array( 'fields' => 'ids', 'orderby' => 'count', 'order' => 'DESC', 'number' => 10 ) ); $categories = get_categories('get=all'); $args = array($categories, 0, $args);