Changeset 11968 for trunk/wp-includes/post.php
- Timestamp:
- 09/24/2009 05:10:28 PM (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/wp-includes/post.php
r11965 r11968 602 602 $post_ids = $wpdb->get_col($wpdb->prepare("SELECT DISTINCT post_id FROM $wpdb->postmeta WHERE meta_key = %s", $post_meta_key)); 603 603 if ( $post_ids ) { 604 $wpdb->query($wpdb->prepare("DELETE FROM $wpdb->postmeta WHERE meta_key = %s", $post_meta_key)); 604 $postmetaids = $wpdb->get_col( $wpdb->prepare( "SELECT meta_id FROM $wpdb->postmeta WHERE meta_key = %s", $post_meta_key ) ); 605 do_action( 'delete_postmeta', $postmetaids ); 606 $wpdb->query( $wpdb->prepare("DELETE FROM $wpdb->postmeta WHERE meta_id IN(%s)", implode( ',', $postmetaids) ) ); 607 do_action( 'deleted_postmeta', $postmetaids ); 605 608 foreach ( $post_ids as $post_id ) 606 609 wp_cache_delete($post_id, 'post_meta'); … … 1103 1106 $wpdb->update( $wpdb->posts, $parent_data, $parent_where + array( 'post_type' => 'attachment' ) ); 1104 1107 1105 $wpdb->query( $wpdb->prepare( "DELETE FROM $wpdb->comments WHERE comment_post_ID = %d", $postid )); 1106 1107 $wpdb->query( $wpdb->prepare( "DELETE FROM $wpdb->postmeta WHERE post_id = %d", $postid )); 1108 1108 $commentids = $wpdb->get_col( $wpdb->prepare( "SELECT comment_ID FROM $wpdb->comments WHERE comment_post_ID = %d", $postid )); 1109 do_action( 'delete_comment', $commentids ); 1110 $wpdb->query( $wpdb->prepare( "DELETE FROM $wpdb->comments WHERE comment_ID IN(%s)", implode( ',', $commentids ) )); 1111 do_action( 'deleted_comment', $commentids ); 1112 1113 $postmetaids = $wpdb->get_col( $wpdb->prepare( "SELECT meta_id FROM $wpdb->postmeta WHERE post_id = %d ", $post_id )); 1114 do_action( 'delete_postmeta', $postmetaids ); 1115 $wpdb->query( $wpdb->prepare( "DELETE FROM $wpdb->postmeta WHERE meta_id IN(%s)", implode( ',', $postmetaids ) )); 1116 do_action( 'deleted_postmeta', $postmetaids ); 1117 1118 do_action( 'delete_post', $post_id ); 1109 1119 $wpdb->query( $wpdb->prepare( "DELETE FROM $wpdb->posts WHERE ID = %d", $postid )); 1120 do_action( 'deleted_post', $post_id ); 1110 1121 1111 1122 if ( 'page' == $post->post_type ) { … … 2585 2596 wp_delete_object_term_relationships($post_id, array('category', 'post_tag')); 2586 2597 2587 $wpdb->query( $wpdb->prepare( "DELETE FROM $wpdb->comments WHERE comment_post_ID = %d", $post_id )); 2588 2589 $wpdb->query( $wpdb->prepare( "DELETE FROM $wpdb->postmeta WHERE post_id = %d ", $post_id )); 2590 2598 $commentids = $wpdb->get_col( $wpdb->prepare( "SELECT comment_ID FROM $wpdb->comments WHERE comment_post_ID = %d", $post_id )); 2599 do_action( 'delete_comment', $commentids ); 2600 $wpdb->query( $wpdb->prepare( "DELETE FROM $wpdb->comments WHERE comment_ID IN(%s)", implode( ',', $commentids ) )); 2601 do_action( 'deleted_comment', $commentids ); 2602 2603 $postmetaids = $wpdb->get_col( $wpdb->prepare( "SELECT meta_id FROM $wpdb->postmeta WHERE post_id = %d ", $post_id )); 2604 do_action( 'delete_postmeta', $postmetaids ); 2605 $wpdb->query( $wpdb->prepare( "DELETE FROM $wpdb->postmeta WHERE meta_id IN(%s)", implode( ',', $postmetaids ) )); 2606 do_action( 'deleted_postmeta', $postmetaids ); 2607 2608 do_action( 'delete_post', $post_id ); 2591 2609 $wpdb->query( $wpdb->prepare( "DELETE FROM $wpdb->posts WHERE ID = %d", $post_id )); 2610 do_action( 'deleted_post', $post_id ); 2592 2611 2593 2612 $uploadpath = wp_upload_dir(); … … 3271 3290 3272 3291 $data = array( 'post_id' => $post_id, 'meta_value' => '1' ); 3273 if ( get_option('default_pingback_flag') ) 3292 if ( get_option('default_pingback_flag') ) { 3274 3293 $wpdb->insert( $wpdb->postmeta, $data + array( 'meta_key' => '_pingme' ) ); 3294 do_action( 'added_postmeta', $wpdb->insert_id, $post_id, '_pingme', 1 ); 3295 } 3275 3296 $wpdb->insert( $wpdb->postmeta, $data + array( 'meta_key' => '_encloseme' ) ); 3297 do_action( 'added_postmeta', $wpdb->insert_id, $post_id, '_encloseme', 1 ); 3298 3276 3299 wp_schedule_single_event(time(), 'do_pings'); 3277 3300 }
Note: See TracChangeset
for help on using the changeset viewer.