Changeset 20435 for trunk/wp-includes/post.php
- Timestamp:
- 04/11/2012 08:02:39 PM (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/wp-includes/post.php
r20423 r20435 2035 2035 2036 2036 $comment_ids = $wpdb->get_col( $wpdb->prepare( "SELECT comment_ID FROM $wpdb->comments WHERE comment_post_ID = %d", $postid )); 2037 if ( ! empty($comment_ids) ) { 2038 do_action( 'delete_comment', $comment_ids ); 2039 foreach ( $comment_ids as $comment_id ) 2040 wp_delete_comment( $comment_id, true ); 2041 do_action( 'deleted_comment', $comment_ids ); 2042 } 2037 foreach ( $comment_ids as $comment_id ) 2038 wp_delete_comment( $comment_id, true ); 2043 2039 2044 2040 $post_meta_ids = $wpdb->get_col( $wpdb->prepare( "SELECT meta_id FROM $wpdb->postmeta WHERE post_id = %d ", $postid )); 2045 if ( !empty($post_meta_ids) ) { 2046 do_action( 'delete_postmeta', $post_meta_ids ); 2047 $in_post_meta_ids = "'" . implode("', '", $post_meta_ids) . "'"; 2048 $wpdb->query( "DELETE FROM $wpdb->postmeta WHERE meta_id IN($in_post_meta_ids)" ); 2049 do_action( 'deleted_postmeta', $post_meta_ids ); 2050 } 2041 foreach ( $post_meta_ids as $mid ) 2042 delete_metadata_by_mid( 'post', $mid ); 2051 2043 2052 2044 do_action( 'delete_post', $postid ); … … 3801 3793 wp_delete_object_term_relationships($post_id, get_object_taxonomies($post->post_type)); 3802 3794 3803 $wpdb->delete( $wpdb->postmeta, array( 'meta_key' => '_thumbnail_id' , 'meta_value' => $post_id ) );3795 delete_metadata( 'post', null, '_thumbnail_id', $post_id, true ); // delete all for any posts. 3804 3796 3805 3797 $comment_ids = $wpdb->get_col( $wpdb->prepare( "SELECT comment_ID FROM $wpdb->comments WHERE comment_post_ID = %d", $post_id )); 3806 if ( ! empty( $comment_ids ) ) { 3807 do_action( 'delete_comment', $comment_ids ); 3808 foreach ( $comment_ids as $comment_id ) 3809 wp_delete_comment( $comment_id, true ); 3810 do_action( 'deleted_comment', $comment_ids ); 3811 } 3798 foreach ( $comment_ids as $comment_id ) 3799 wp_delete_comment( $comment_id, true ); 3812 3800 3813 3801 $post_meta_ids = $wpdb->get_col( $wpdb->prepare( "SELECT meta_id FROM $wpdb->postmeta WHERE post_id = %d ", $post_id )); 3814 if ( !empty($post_meta_ids) ) { 3815 do_action( 'delete_postmeta', $post_meta_ids ); 3816 $in_post_meta_ids = "'" . implode("', '", $post_meta_ids) . "'"; 3817 $wpdb->query( "DELETE FROM $wpdb->postmeta WHERE meta_id IN($in_post_meta_ids)" ); 3818 do_action( 'deleted_postmeta', $post_meta_ids ); 3819 } 3802 foreach ( $post_meta_ids as $mid ) 3803 delete_metadata_by_mid( 'post', $mid ); 3820 3804 3821 3805 do_action( 'delete_post', $post_id ); … … 4564 4548 return; 4565 4549 4566 $data = array( 'post_id' => $post_id, 'meta_value' => '1' ); 4567 if ( get_option('default_pingback_flag') ) { 4568 $wpdb->insert( $wpdb->postmeta, $data + array( 'meta_key' => '_pingme' ) ); 4569 do_action( 'added_postmeta', $wpdb->insert_id, $post_id, '_pingme', 1 ); 4570 } 4571 $wpdb->insert( $wpdb->postmeta, $data + array( 'meta_key' => '_encloseme' ) ); 4572 do_action( 'added_postmeta', $wpdb->insert_id, $post_id, '_encloseme', 1 ); 4550 if ( get_option('default_pingback_flag') ) 4551 add_post_meta( $post_id, '_pingme', '1' ); 4552 add_post_meta( $post_id, '_encloseme', '1' ); 4573 4553 4574 4554 wp_schedule_single_event(time(), 'do_pings');
Note: See TracChangeset
for help on using the changeset viewer.