Changeset 5556 for trunk/wp-includes/post.php
- Timestamp:
- 05/27/2007 05:15:18 AM (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/wp-includes/post.php
r5555 r5556 411 411 do_action('delete_post', $postid); 412 412 413 if ( 'publish' == $post->post_status && 'post' == $post->post_type ) { 414 $categories = wp_get_post_categories($post->ID); 415 if ( is_array( $categories ) ) { 416 foreach ( $categories as $cat_id ) { 417 $wpdb->query("UPDATE $wpdb->categories SET category_count = category_count - 1 WHERE cat_ID = '$cat_id'"); 418 wp_cache_delete($cat_id, 'category'); 419 do_action('edit_category', $cat_id); 420 } 421 } 422 } 413 // TODO delete for pluggable post taxonomies too 414 wp_delete_object_term_relationships($postid, array('category', 'post_tag')); 423 415 424 416 if ( 'page' == $post->post_type ) … … 430 422 431 423 $wpdb->query("DELETE FROM $wpdb->comments WHERE comment_post_ID = $postid"); 432 433 $wpdb->query("DELETE FROM $wpdb->post2cat WHERE post_id = $postid");434 424 435 425 $wpdb->query("DELETE FROM $wpdb->postmeta WHERE post_id = $postid"); … … 445 435 } 446 436 447 function wp_get_post_categories( $post_id = 0) {437 function wp_get_post_categories( $post_id = 0, $args = array() ) { 448 438 $post_id = (int) $post_id; 449 439 450 $cats = get_object_terms($post_id, 'category', 'get=fields'); 440 $defaults = array('fields' => 'ids'); 441 $args = wp_parse_args( $args, $defaults ); 442 443 $cats = get_object_terms($post_id, 'category', $args); 451 444 return $cats; 452 445 } 453 446 454 function wp_get_post_tags( $post_id = 0 ) { 455 global $tag_cache, $blog_id; 456 447 function wp_get_post_tags( $post_id = 0, $args = array() ) { 457 448 $post_id = (int) $post_id; 449 450 $defaults = array('fields' => 'all'); 451 $args = wp_parse_args( $args, $defaults ); 458 452 459 $tags = get_object_terms($post_id, 'post_tag'); 453 $tags = get_object_terms($post_id, 'post_tag', $args); 454 460 455 return $tags; 461 456 }
Note: See TracChangeset
for help on using the changeset viewer.