Changeset 11878 for trunk/wp-includes/post.php
- Timestamp:
- 08/25/2009 10:05:15 PM (17 years ago)
- File:
-
- 1 edited
-
trunk/wp-includes/post.php (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/wp-includes/post.php
r11841 r11878 1150 1150 do_action('delete_post', $postid); 1151 1151 1152 $trash_meta = get_option('wp_trash_meta'); 1153 if ( is_array($trash_meta) && isset($trash_meta['posts'][$postid]) ) { 1154 unset($trash_meta['posts'][$postid]); 1155 update_option('wp_trash_meta', $trash_meta); 1156 } 1152 delete_post_meta($postid,'_wp_trash_meta_status'); 1153 delete_post_meta($postid,'_wp_trash_meta_time'); 1157 1154 1158 1155 /** @todo delete for pluggable post taxonomies too */ … … 1225 1222 * @return mixed False on failure 1226 1223 */ 1227 function wp_trash_post($post id = 0) {1224 function wp_trash_post($post_id = 0) { 1228 1225 if ( EMPTY_TRASH_DAYS == 0 ) 1229 return wp_delete_post($post id);1230 1231 if ( !$post = wp_get_single_post($post id, ARRAY_A) )1226 return wp_delete_post($post_id); 1227 1228 if ( !$post = wp_get_single_post($post_id, ARRAY_A) ) 1232 1229 return $post; 1233 1230 1234 do_action('trash_post', $postid); 1235 1236 $trash_meta = get_option('wp_trash_meta'); 1237 if ( !is_array($trash_meta) ) 1238 $trash_meta = array(); 1239 $trash_meta['posts'][$postid]['status'] = $post['post_status']; 1240 $trash_meta['posts'][$postid]['time'] = time(); 1241 update_option('wp_trash_meta', $trash_meta); 1231 do_action('trash_post', $post_id); 1232 1233 add_post_meta($post_id,'_wp_trash_meta_status', $post['post_status']); 1234 add_post_meta($post_id,'_wp_trash_meta_time', time()); 1242 1235 1243 1236 $post['post_status'] = 'trash'; 1244 1237 wp_insert_post($post); 1245 1238 1246 do_action('trashed_post', $post id);1239 do_action('trashed_post', $post_id); 1247 1240 1248 1241 return $post; … … 1259 1252 * @return mixed False on failure 1260 1253 */ 1261 function wp_untrash_post($post id = 0) {1262 if ( !$post = wp_get_single_post($post id, ARRAY_A) )1254 function wp_untrash_post($post_id = 0) { 1255 if ( !$post = wp_get_single_post($post_id, ARRAY_A) ) 1263 1256 return $post; 1264 1257 1265 do_action('untrash_post', $postid); 1266 1267 $post['post_status'] = ($post->post_type == 'attachment') ? 'inherit' : 'draft'; 1268 1269 $trash_meta = get_option('wp_trash_meta'); 1270 if ( is_array($trash_meta) && isset($trash_meta['posts'][$postid]) ) { 1271 $post['post_status'] = $trash_meta['posts'][$postid]['status']; 1272 unset($trash_meta['posts'][$postid]); 1273 update_option('wp_trash_meta', $trash_meta); 1274 } 1258 do_action('untrash_post', $post_id); 1259 1260 $post['post_status'] = ('attachment' == $post['post_type'] ) ? 'inherit' : 'draft'; 1261 1262 delete_post_meta($post_id,'_wp_trash_meta_status'); 1263 delete_post_meta($post_id,'_wp_trash_meta_time'); 1275 1264 1276 1265 wp_insert_post($post); 1277 1266 1278 do_action('untrashed_post', $post id);1267 do_action('untrashed_post', $post_id); 1279 1268 1280 1269 return $post; … … 2667 2656 return wp_trash_post($postid); 2668 2657 2669 $trash_meta = get_option('wp_trash_meta'); 2670 if ( is_array($trash_meta) && isset($trash_meta['posts'][$postid]) ) { 2671 unset($trash_meta['posts'][$postid]); 2672 update_option('wp_trash_meta', $trash_meta); 2673 } 2658 delete_post_meta($post_id,'_wp_trash_meta_status'); 2659 delete_post_meta($post_id,'_wp_trash_meta_time'); 2660 2674 2661 2675 2662 $meta = wp_get_attachment_metadata( $postid );
Note:
See TracChangeset
for help on using the changeset viewer.
![(please configure the [header_logo] section in trac.ini)](/chrome/site/your_project_logo.png)