Changeset 5184 for trunk/wp-includes/post.php
- Timestamp:
- 04/05/2007 09:16:02 PM (18 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/wp-includes/post.php
r5158 r5184 788 788 continue; // discard 789 789 if ( !$tag_id = category_exists( $tag ) ) 790 $tag_id = wp_create_ category( $tag );790 $tag_id = wp_create_tag( $tag ); 791 791 $tag_ids[] = $tag_id; 792 792 } … … 838 838 foreach ( $all_affected_tags as $tag_id ) { 839 839 $count = $wpdb->get_var( "SELECT COUNT(*) FROM $wpdb->post2cat, $wpdb->posts WHERE $wpdb->posts.ID=$wpdb->post2cat.post_id AND post_status = 'publish' AND post_type = 'post' AND category_id = '$tag_id' AND rel_type = 'tag'" ); 840 $wpdb->query( "UPDATE $wpdb->categories SET tag_count = '$count' WHERE cat_ID = '$tag_id'" );840 $wpdb->query( "UPDATE $wpdb->categories SET tag_count = '$count', type = type | " . TAXONOMY_TAG . " WHERE cat_ID = '$tag_id'" ); 841 841 if ( $count == 0 ) 842 $wpdb->query( "UPDATE $wpdb->categories SET t ag_count = '-1'WHERE cat_ID = '$tag_id'" );842 $wpdb->query( "UPDATE $wpdb->categories SET type = type & ~". TAXONOMY_TAG . " WHERE cat_ID = '$tag_id'" ); 843 843 clean_category_cache( $tag_id ); 844 844 do_action( 'edit_category', $tag_id ); … … 877 877 DELETE FROM $wpdb->post2cat 878 878 WHERE category_id = '$del' 879 AND post_id = '$post_ID' 879 AND post_id = '$post_ID' AND rel_type = 'category' 880 880 "); 881 881 } … … 899 899 foreach ( $all_affected_cats as $cat_id ) { 900 900 $count = $wpdb->get_var("SELECT COUNT(*) FROM $wpdb->post2cat, $wpdb->posts WHERE $wpdb->posts.ID=$wpdb->post2cat.post_id AND post_status = 'publish' AND post_type = 'post' AND category_id = '$cat_id' AND rel_type = 'category'"); 901 $wpdb->query("UPDATE $wpdb->categories SET category_count = '$count' WHERE cat_ID = '$cat_id'");901 $wpdb->query("UPDATE $wpdb->categories SET category_count = '$count', type = type | " . TAXONOMY_CATEGORY . " WHERE cat_ID = '$cat_id'"); 902 902 clean_category_cache($cat_id); 903 903 do_action('edit_category', $cat_id);
Note: See TracChangeset
for help on using the changeset viewer.