Ticket #30940: 30940-2.patch
| File 30940-2.patch, 2.8 KB (added by , 12 years ago) |
|---|
-
post.php
2581 2581 function wp_delete_post( $postid = 0, $force_delete = false ) { 2582 2582 global $wpdb; 2583 2583 2584 if ( !$ post = $wpdb->get_row($wpdb->prepare("SELECT * FROM $wpdb->posts WHERE ID = %d", $postid)) )2585 return $ post;2584 if ( !$_post = $wpdb->get_row($wpdb->prepare("SELECT * FROM $wpdb->posts WHERE ID = %d", $postid)) ) 2585 return $_post; 2586 2586 2587 if ( !$force_delete && ( $ post->post_type == 'post' || $post->post_type == 'page') && get_post_status( $postid ) != 'trash' && EMPTY_TRASH_DAYS )2587 if ( !$force_delete && ( $_post->post_type == 'post' || $_post->post_type == 'page') && get_post_status( $postid ) != 'trash' && EMPTY_TRASH_DAYS ) 2588 2588 return wp_trash_post($postid); 2589 2589 2590 if ( $ post->post_type == 'attachment' )2590 if ( $_post->post_type == 'attachment' ) 2591 2591 return wp_delete_attachment( $postid, $force_delete ); 2592 2593 $post = new WP_Post( $_post ); 2592 2594 2593 2595 /** 2594 2596 * Fires before a post is deleted, at the start of wp_delete_post(). 2595 2597 * 2596 2598 * @since 3.2.0 2599 * @since 4.2.0 Introduced the '$post' parameter. 2597 2600 * 2598 2601 * @see wp_delete_post() 2599 2602 * 2600 * @param int $postid Post ID. 2603 * @param int $postid Post ID. 2604 * @param object $post Post object. 2601 2605 */ 2602 do_action( 'before_delete_post', $postid );2606 do_action( 'before_delete_post', $postid, $post ); 2603 2607 2604 2608 delete_post_meta($postid,'_wp_trash_meta_status'); 2605 2609 delete_post_meta($postid,'_wp_trash_meta_time'); … … 2638 2642 * Fires immediately before a post is deleted from the database. 2639 2643 * 2640 2644 * @since 1.2.0 2645 * @since 4.2.0 Introduced the '$post' parameter. 2641 2646 * 2642 * @param int $postid Post ID. 2647 * @param int $postid Post ID. 2648 * @param object $post Post object. 2643 2649 */ 2644 do_action( 'delete_post', $postid );2650 do_action( 'delete_post', $postid, $post ); 2645 2651 $result = $wpdb->delete( $wpdb->posts, array( 'ID' => $postid ) ); 2646 2652 if ( ! $result ) { 2647 2653 return false; … … 2651 2657 * Fires immediately after a post is deleted from the database. 2652 2658 * 2653 2659 * @since 2.2.0 2660 * @since 4.2.0 Introduced the '$post' parameter. 2654 2661 * 2655 * @param int $postid Post ID. 2662 * @param int $postid Post ID. 2663 * @param object $post Post object. 2656 2664 */ 2657 do_action( 'deleted_post', $postid );2665 do_action( 'deleted_post', $postid, $post ); 2658 2666 2659 2667 clean_post_cache( $post ); 2660 2668 … … 2669 2677 * Fires after a post is deleted, at the conclusion of wp_delete_post(). 2670 2678 * 2671 2679 * @since 3.2.0 2680 * @since 4.2.0 Introduced the '$post' parameter. 2672 2681 * 2673 2682 * @see wp_delete_post() 2674 2683 * 2675 * @param int $postid Post ID. 2684 * @param int $postid Post ID. 2685 * @param object $post Post object. 2676 2686 */ 2677 do_action( 'after_delete_post', $postid );2687 do_action( 'after_delete_post', $postid, $post ); 2678 2688 2679 2689 return $post; 2680 2690 }
![(please configure the [header_logo] section in trac.ini)](/chrome/site/your_project_logo.png)