Changeset 12158 for trunk/wp-includes/post.php
- Timestamp:
- 11/09/2009 08:12:07 PM (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/wp-includes/post.php
r12156 r12158 1150 1150 * 1151 1151 * @param int $postid Post ID. 1152 * @param bool $force_delete Whether to bypass trash and force deletion 1152 1153 * @return mixed False on failure 1153 1154 */ 1154 function wp_delete_post( $postid = 0) {1155 function wp_delete_post( $postid = 0, $force_delete = false ) { 1155 1156 global $wpdb, $wp_rewrite; 1156 1157 … … 1158 1159 return $post; 1159 1160 1160 if ( ($post->post_type == 'post' || $post->post_type == 'page') && get_post_status($postid) != 'trash' && EMPTY_TRASH_DAYS > 0 )1161 return wp_trash_post($postid);1161 if ( !$force_delete && ( $post->post_type == 'post' || $post->post_type == 'page') && get_post_status( $postid ) != 'trash' && EMPTY_TRASH_DAYS > 0 ) 1162 return wp_trash_post($postid); 1162 1163 1163 1164 if ( $post->post_type == 'attachment' ) 1164 return wp_delete_attachment( $postid);1165 return wp_delete_attachment( $postid, $force_delete ); 1165 1166 1166 1167 do_action('delete_post', $postid); … … 2800 2801 * 2801 2802 * @param int $postid Attachment ID. 2803 * @param bool $force_delete Whether to bypass trash and force deletion 2802 2804 * @return mixed False on failure. Post data on success. 2803 2805 */ 2804 function wp_delete_attachment( $post_id) {2806 function wp_delete_attachment( $post_id, $force_delete = false ) { 2805 2807 global $wpdb; 2806 2808 … … 2811 2813 return false; 2812 2814 2813 if ( 'trash' != $post->post_status )2814 return wp_trash_post( $post_id);2815 if ( !$force_delete && 'trash' != $post->post_status ) 2816 return wp_trash_post( $post_id ); 2815 2817 2816 2818 delete_post_meta($post_id, '_wp_trash_meta_status');
Note: See TracChangeset
for help on using the changeset viewer.