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"' : ''; ?>