From 317b6301734d44e0f0c40390b02c6ca599e3eb92 Mon Sep 17 00:00:00 2001 From: Dion Hulse Date: Fri, 5 Feb 2010 14:16:31 +0000 Subject: [PATCH] update wp_popular_terms_checklist() to handle custom taxonomies. See #10122 git-svn-id: https://develop.svn.wordpress.org/trunk@12966 602fd350-edb4-49c9-b593-d223f7449a82 --- wp-admin/includes/template.php | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/wp-admin/includes/template.php b/wp-admin/includes/template.php index 2273cfb86f..81c8f70e09 100644 --- a/wp-admin/includes/template.php +++ b/wp-admin/includes/template.php @@ -582,25 +582,25 @@ function wp_popular_terms_checklist( $taxonomy, $default = 0, $number = 10, $ech global $post_ID; if ( $post_ID ) - $checked_categories = wp_get_object_terms($post_ID, 'category', array('fields'=>'ids')); + $checked_terms = wp_get_object_terms($post_ID, $taxonomy, array('fields'=>'ids')); else - $checked_categories = array(); + $checked_terms = array(); - $categories = get_terms( $taxonomy, array( 'orderby' => 'count', 'order' => 'DESC', 'number' => $number, 'hierarchical' => false ) ); + $terms = get_terms( $taxonomy, array( 'orderby' => 'count', 'order' => 'DESC', 'number' => $number, 'hierarchical' => false ) ); $popular_ids = array(); - foreach ( (array) $categories as $category ) { - $popular_ids[] = $category->term_id; + foreach ( (array) $terms as $term ) { + $popular_ids[] = $term->term_id; if ( !$echo ) // hack for AJAX use continue; - $id = "popular-$taxonomy-$category->term_id"; - $checked = in_array( $category->term_id, $checked_categories ) ? 'checked="checked"' : ''; + $id = "popular-$taxonomy-$term->term_id"; + $checked = in_array( $term->term_id, $checked_terms ) ? 'checked="checked"' : ''; ?> @@ -2699,7 +2699,7 @@ function meta_form() { ?> - + @@ -3376,7 +3376,7 @@ function find_posts_div($found_action = '') { -
+
@@ -3386,7 +3386,7 @@ function find_posts_div($found_action = '') {
- +