Changeset 5110 for trunk/wp-admin/admin-functions.php
- Timestamp:
- 03/26/2007 07:28:29 AM (19 years ago)
- File:
-
- 1 edited
-
trunk/wp-admin/admin-functions.php (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/wp-admin/admin-functions.php
r5089 r5110 648 648 function return_categories_list( $parent = 0 ) { 649 649 global $wpdb; 650 return $wpdb->get_col( "SELECT cat_ID FROM $wpdb->categories WHERE category_parent = $parent AND ( link_count = 0 OR category_count != 0 OR ( link_count = 0 AND category_count = 0 ) ) ORDER BY category_count DESC" );650 return $wpdb->get_col( "SELECT cat_ID FROM $wpdb->categories WHERE category_parent = $parent AND ( ( link_count = 0 AND tag_count = 0 ) OR category_count != 0 OR ( link_count = 0 AND category_count = 0 AND tag_count = 0 ) ) ORDER BY category_count DESC" ); 651 651 } 652 652 … … 658 658 } 659 659 660 function get_tags_to_edit( $post_id ) { 661 global $wpdb; 662 663 $post_id = (int) $post_id; 664 if ( !$post_id ) 665 return false; 666 667 $tags = $wpdb->get_results( " 668 SELECT category_id, cat_name 669 FROM $wpdb->categories, $wpdb->post2cat 670 WHERE $wpdb->post2cat.category_id = cat_ID AND $wpdb->post2cat.post_id = '$post_id' AND rel_type = 'tag' 671 " ); 672 if ( !$tags ) 673 return false; 674 675 foreach ( $tags as $tag ) 676 $tag_names[] = $tag->cat_name; 677 $tags_to_edit = join( ', ', $tag_names ); 678 $tags_to_edit = attribute_escape( $tags_to_edit ); 679 $tags_to_edit = apply_filters( 'tags_to_edit', $tags_to_edit ); 680 return $tags_to_edit; 681 } 682 660 683 function get_nested_categories( $default = 0, $parent = 0 ) { 661 684 global $post_ID, $link_id, $mode, $wpdb; … … 665 688 SELECT category_id 666 689 FROM $wpdb->categories, $wpdb->post2cat 667 WHERE $wpdb->post2cat.category_id = cat_ID AND $wpdb->post2cat.post_id = '$post_ID' 690 WHERE $wpdb->post2cat.category_id = cat_ID AND $wpdb->post2cat.post_id = '$post_ID' AND rel_type = 'category' 668 691 " ); 669 692 … … 722 745 function return_link_categories_list( $parent = 0 ) { 723 746 global $wpdb; 724 return $wpdb->get_col( "SELECT cat_ID FROM $wpdb->categories WHERE category_parent = $parent AND ( category_count = 0 OR link_count != 0 OR ( link_count = 0 AND category_count = 0 ) ) ORDER BY link_count DESC" );747 return $wpdb->get_col( "SELECT cat_ID FROM $wpdb->categories WHERE category_parent = $parent AND ( ( category_count = 0 AND tag_count = 0 ) OR link_count != 0 OR ( link_count = 0 AND category_count = 0 AND tag_count = 0 ) ) ORDER BY link_count DESC" ); 725 748 } 726 749
Note: See TracChangeset
for help on using the changeset viewer.