Index: wp-includes/post.php
===================================================================
--- wp-includes/post.php	(revision 11740)
+++ wp-includes/post.php	(working copy)
@@ -998,7 +998,7 @@
 
 	$count = $wpdb->get_results( $wpdb->prepare( $query, $type ), ARRAY_A );
 
-	$stats = array( 'publish' => 0, 'private' => 0, 'draft' => 0, 'pending' => 0, 'future' => 0 );
+	$stats = array( 'publish' => 0, 'private' => 0, 'draft' => 0, 'pending' => 0, 'future' => 0, 'deleted' => 0 );
 	foreach( (array) $count as $row_num => $row ) {
 		$stats[$row['post_status']] = $row['num_posts'];
 	}
@@ -1135,6 +1135,12 @@
  * @return mixed False on failure
  */
 function wp_delete_post($postid = 0) {
+	if (get_post_status($postid) != 'deleted') {
+		wp_update_post(array('ID'=>$postid, 'post_status'=>'deleted'));
+		wp_schedule_post_destruction($postid);
+		return true;
+	}
+	
 	global $wpdb, $wp_rewrite;
 
 	if ( !$post = $wpdb->get_row($wpdb->prepare("SELECT * FROM $wpdb->posts WHERE ID = %d", $postid)) )
@@ -1144,6 +1150,8 @@
 		return wp_delete_attachment($postid);
 
 	do_action('delete_post', $postid);
+	
+	wp_unschedule_post_destruction($postid);
 
 	/** @todo delete for pluggable post taxonomies too */
 	wp_delete_object_term_relationships($postid, array('category', 'post_tag'));
@@ -1205,6 +1213,69 @@
 }
 
 /**
+ * Removes a post or page from the Trash
+ *
+ * @since 2.9.0
+ * @uses do_action() on 'undelete_post' before deletion
+ * @uses do_action() on 'undeleted_post' after deletion
+ *
+ * @param int $postid Post ID.
+ * @return mixed False on failure
+ */
+function wp_undelete_post($postid = 0) {
+	global $wpdb, $wp_rewrite;
+
+	if ( !$post = $wpdb->get_row($wpdb->prepare("SELECT * FROM $wpdb->posts WHERE ID = %d", $postid)) )
+		return $post;
+
+	do_action('undelete_post', $postid);
+	
+	wp_update_post(array('ID'=>$postid, 'post_status'=>'draft'));
+	
+	wp_unschedule_post_destruction($postid);
+
+	do_action('undeleted_post', $postid);
+
+	return $post;
+}
+
+/**
+ * Schedules a post for destruction.
+ * 
+ * @since 2.9.0
+ * 
+ * @param int $post_id Post ID.
+ * @return void
+ */
+function wp_schedule_post_destruction($post_id) {
+	$to_destroy = get_option('to_destroy');
+	if (!is_array($to_destroy))
+		$to_destroy = array();
+	
+	$to_destroy['posts'][$post_id] = time();
+	
+	update_option('to_destroy', $to_destroy);
+}
+
+/**
+ * Unschedules a post for destruction.
+ * 
+ * @since 2.9.0
+ * 
+ * @param int $post_id Post ID.
+ * @return void
+ */
+function wp_unschedule_post_destruction($post_id) {
+	$to_destroy = get_option('to_destroy');
+	if (!is_array($to_destroy))
+		return;
+	
+	unset($to_destroy['posts'][$post_id]);
+	
+	update_option('to_destroy', $to_destroy);
+}
+
+/**
  * Retrieve the list of categories for a post.
  *
  * Compatibility layer for themes and plugins. Also an easy layer of abstraction
Index: wp-includes/query.php
===================================================================
--- wp-includes/query.php	(revision 11740)
+++ wp-includes/query.php	(working copy)
@@ -2099,6 +2099,8 @@
 				$p_status[] = "$wpdb->posts.post_status = 'private'";
 			if ( in_array( 'publish', $q_status ) )
 				$r_status[] = "$wpdb->posts.post_status = 'publish'";
+			if ( in_array( 'deleted', $q_status ) )
+				$r_status[] = "$wpdb->posts.post_status = 'deleted'";
 
 			if ( empty($q['perm'] ) || 'readable' != $q['perm'] ) {
 				$r_status = array_merge($r_status, $p_status);
Index: wp-includes/pluggable.php
===================================================================
--- wp-includes/pluggable.php	(revision 11740)
+++ wp-includes/pluggable.php	(working copy)
@@ -1768,8 +1768,7 @@
 endif;
 
 /**
- * Destroys comments which have previously been scheduled for destruction.
- * Will do the same for posts, pages, etc in the future.
+ * Destroys posts, pages, and comments which have previously been scheduled for destruction.
  * 
  * @access private
  * @since 2.9.0
@@ -1788,6 +1787,12 @@
 			unset($to_destroy['comments'][$comment_id]);
 		}
 	}
+	foreach ($to_destroy['posts'] as $post_id => $timestamp) {
+		if ($timestamp < $deletetimestamp) {
+			wp_delete_post($post_id);
+			unset($to_destroy['posts'][$post_id]);
+		}
+	}
 
 	update_option('to_destroy', $to_destroy);
 }
Index: wp-admin/includes/post.php
===================================================================
--- wp-admin/includes/post.php	(revision 11740)
+++ wp-admin/includes/post.php	(working copy)
@@ -795,6 +795,7 @@
 				'pending' => array(_x('Pending Review', 'post'), __('Pending posts'), _n_noop('Pending Review <span class="count">(%s)</span>', 'Pending Review <span class="count">(%s)</span>')),
 				'draft' => array(_x('Draft', 'post'), _x('Drafts', 'manage posts header'), _n_noop('Draft <span class="count">(%s)</span>', 'Drafts <span class="count">(%s)</span>')),
 				'private' => array(_x('Private', 'post'), __('Private posts'), _n_noop('Private <span class="count">(%s)</span>', 'Private <span class="count">(%s)</span>')),
+				'deleted' => array(_x('Trash', 'post'), __('Trash posts'), _n_noop('Trash <span class="count">(%s)</span>', 'Trash <span class="count">(%s)</span>')),
 			);
 
 	$post_stati = apply_filters('post_stati', $post_stati);
Index: wp-admin/includes/template.php
===================================================================
--- wp-admin/includes/template.php	(revision 11740)
+++ wp-admin/includes/template.php	(working copy)
@@ -1435,24 +1435,29 @@
 		case 'title':
 			$attributes = 'class="post-title column-title"' . $style;
 		?>
-		<td <?php echo $attributes ?>><strong><?php if ( current_user_can( 'edit_post', $post->ID ) ) { ?><a class="row-title" href="<?php echo $edit_link; ?>" title="<?php echo esc_attr(sprintf(__('Edit &#8220;%s&#8221;'), $title)); ?>"><?php echo $title ?></a><?php } else { echo $title; }; _post_states($post); ?></strong>
+		<td <?php echo $attributes ?>><strong><?php if ( current_user_can('edit_post', $post->ID) && $post->post_status != 'deleted' ) { ?><a class="row-title" href="<?php echo $edit_link; ?>" title="<?php echo esc_attr(sprintf(__('Edit &#8220;%s&#8221;'), $title)); ?>"><?php echo $title ?></a><?php } else { echo $title; }; _post_states($post); ?></strong>
 		<?php
 			if ( 'excerpt' == $mode )
 				the_excerpt();
 
 			$actions = array();
-			if ( current_user_can('edit_post', $post->ID) ) {
-				$actions['edit'] = '<a href="' . get_edit_post_link($post->ID, true) . '" title="' . esc_attr(__('Edit this post')) . '">' . __('Edit') . '</a>';
-				$actions['inline hide-if-no-js'] = '<a href="#" class="editinline" title="' . esc_attr(__('Edit this post inline')) . '">' . __('Quick&nbsp;Edit') . '</a>';
-			}
-			if ( current_user_can('delete_post', $post->ID) ) {
-				$actions['delete'] = "<a class='submitdelete' title='" . esc_attr(__('Delete this post')) . "' href='" . wp_nonce_url("post.php?action=delete&amp;post=$post->ID", 'delete-post_' . $post->ID) . "' onclick=\"if ( confirm('" . esc_js(sprintf( ('draft' == $post->post_status) ? __("You are about to delete this draft '%s'\n 'Cancel' to stop, 'OK' to delete.") : __("You are about to delete this post '%s'\n 'Cancel' to stop, 'OK' to delete."), $post->post_title )) . "') ) { return true;}return false;\">" . __('Delete') . "</a>";
-			}
-			if ( in_array($post->post_status, array('pending', 'draft')) ) {
-				if ( current_user_can('edit_post', $post->ID) )
-					$actions['view'] = '<a href="' . get_permalink($post->ID) . '" title="' . esc_attr(sprintf(__('Preview &#8220;%s&#8221;'), $title)) . '" rel="permalink">' . __('Preview') . '</a>';
+			if ( 'deleted' == $post->post_status ) {
+				$actions['undelete'] = "<a title='" . esc_attr(__('Remove this post from the Trash')) . "' href='" . wp_nonce_url("post.php?action=undelete&amp;post=$post->ID", 'undelete-post_' . $post->ID) . "'>" . __('Return to Drafts') . "</a>";
+				$actions['delete'] = "<a class='submitdelete' title='" . esc_attr(__('Delete this post permanently')) . "' href='" . wp_nonce_url("post.php?action=delete&amp;post=$post->ID", 'delete-post_' . $post->ID) . "' onclick=\"if ( confirm('" . esc_js(sprintf(__("You are about to permanently delete this post '%s'\n 'Cancel' to stop, 'OK' to delete."), $post->post_title )) . "') ) { return true;}return false;\">" . __('Delete Permanently') . "</a>";
 			} else {
-				$actions['view'] = '<a href="' . get_permalink($post->ID) . '" title="' . esc_attr(sprintf(__('View &#8220;%s&#8221;'), $title)) . '" rel="permalink">' . __('View') . '</a>';
+				if ( current_user_can('edit_post', $post->ID) ) {
+					$actions['edit'] = '<a href="' . get_edit_post_link($post->ID, true) . '" title="' . esc_attr(__('Edit this post')) . '">' . __('Edit') . '</a>';
+					$actions['inline hide-if-no-js'] = '<a href="#" class="editinline" title="' . esc_attr(__('Edit this post inline')) . '">' . __('Quick&nbsp;Edit') . '</a>';
+				}
+				if ( current_user_can('delete_post', $post->ID) ) {
+					$actions['delete'] = "<a class='submitdelete' title='" . esc_attr(__('Move this post to the Trash')) . "' href='" . wp_nonce_url("post.php?action=delete&amp;post=$post->ID", 'delete-post_' . $post->ID) . "'>" . __('Move to Trash') . "</a>";
+				}
+				if ( in_array($post->post_status, array('pending', 'draft')) ) {
+					if ( current_user_can('edit_post', $post->ID) )
+						$actions['view'] = '<a href="' . get_permalink($post->ID) . '" title="' . esc_attr(sprintf(__('Preview &#8220;%s&#8221;'), $title)) . '" rel="permalink">' . __('Preview') . '</a>';
+				} else {
+					$actions['view'] = '<a href="' . get_permalink($post->ID) . '" title="' . esc_attr(sprintf(__('View &#8220;%s&#8221;'), $title)) . '" rel="permalink">' . __('View') . '</a>';
+				}
 			}
 			$actions = apply_filters('post_row_actions', $actions, $post);
 			$action_count = count($actions);
@@ -1653,21 +1658,28 @@
 		$attributes = 'class="post-title page-title column-title"' . $style;
 		$edit_link = get_edit_post_link( $page->ID );
 		?>
-		<td <?php echo $attributes ?>><strong><?php if ( current_user_can( 'edit_page', $page->ID ) ) { ?><a class="row-title" href="<?php echo $edit_link; ?>" title="<?php echo esc_attr(sprintf(__('Edit &#8220;%s&#8221;'), $title)); ?>"><?php echo $pad; echo $title ?></a><?php } else { echo $pad; echo $title; }; _post_states($page); echo isset($parent_name) ? ' | ' . __('Parent Page: ') . esc_html($parent_name) : ''; ?></strong>
+		<td <?php echo $attributes ?>><strong><?php if ( current_user_can('edit_page', $page->ID) && $post->post_status != 'deleted' ) { ?><a class="row-title" href="<?php echo $edit_link; ?>" title="<?php echo esc_attr(sprintf(__('Edit &#8220;%s&#8221;'), $title)); ?>"><?php echo $pad; echo $title ?></a><?php } else { echo $pad; echo $title; }; _post_states($page); echo isset($parent_name) ? ' | ' . __('Parent Page: ') . esc_html($parent_name) : ''; ?></strong>
 		<?php
 		$actions = array();
-		if ( current_user_can('edit_page', $page->ID) ) {
-			$actions['edit'] = '<a href="' . $edit_link . '" title="' . esc_attr(__('Edit this page')) . '">' . __('Edit') . '</a>';
-			$actions['inline'] = '<a href="#" class="editinline">' . __('Quick&nbsp;Edit') . '</a>';
-		}
-		if ( current_user_can('delete_page', $page->ID) ) {
-			$actions['delete'] = "<a class='submitdelete' title='" . esc_attr(__('Delete this page')) . "' href='" . wp_nonce_url("page.php?action=delete&amp;post=$page->ID", 'delete-page_' . $page->ID) . "' onclick=\"if ( confirm('" . esc_js(sprintf( ('draft' == $page->post_status) ? __("You are about to delete this draft '%s'\n 'Cancel' to stop, 'OK' to delete.") : __("You are about to delete this page '%s'\n 'Cancel' to stop, 'OK' to delete."), $page->post_title )) . "') ) { return true;}return false;\">" . __('Delete') . "</a>";
-		}
-		if ( in_array($post->post_status, array('pending', 'draft')) ) {
-			if ( current_user_can('edit_page', $page->ID) )
-				$actions['view'] = '<a href="' . get_permalink($page->ID) . '" title="' . esc_attr(sprintf(__('Preview &#8220;%s&#8221;'), $title)) . '" rel="permalink">' . __('Preview') . '</a>';
+		if ($post->post_status == 'deleted') {
+			if ( current_user_can('delete_page', $page->ID) ) {
+				$actions['undelete'] = "<a title='" . esc_attr(__('Remove this page from the Trash')) . "' href='" . wp_nonce_url("page.php?action=undelete&amp;post=$page->ID", 'undelete-page_' . $page->ID) . "'>" . __('Return to Drafts') . "</a>";
+				$actions['delete'] = "<a class='submitdelete' title='" . esc_attr(__('Delete this page permanently')) . "' href='" . wp_nonce_url("page.php?action=delete&amp;post=$page->ID", 'delete-page_' . $page->ID) . "' onclick=\"if ( confirm('" . esc_js(sprintf(__("You are about to permanently delete this page '%s'\n 'Cancel' to stop, 'OK' to delete."), $page->post_title )) . "') ) { return true;}return false;\">" . __('Delete Permanently') . "</a>";
+			}
 		} else {
-			$actions['view'] = '<a href="' . get_permalink($page->ID) . '" title="' . esc_attr(sprintf(__('View &#8220;%s&#8221;'), $title)) . '" rel="permalink">' . __('View') . '</a>';
+			if ( current_user_can('edit_page', $page->ID) ) {
+				$actions['edit'] = '<a href="' . $edit_link . '" title="' . esc_attr(__('Edit this page')) . '">' . __('Edit') . '</a>';
+				$actions['inline'] = '<a href="#" class="editinline">' . __('Quick&nbsp;Edit') . '</a>';
+			}
+			if ( current_user_can('delete_page', $page->ID) ) {
+				$actions['delete'] = "<a class='submitdelete' title='" . esc_attr(__('Move this page to the Trash')) . "' href='" . wp_nonce_url("page.php?action=delete&amp;post=$page->ID", 'delete-page_' . $page->ID) . "'>" . __('Move to Trash') . "</a>";
+			}
+			if ( in_array($post->post_status, array('pending', 'draft')) ) {
+				if ( current_user_can('edit_page', $page->ID) )
+					$actions['view'] = '<a href="' . get_permalink($page->ID) . '" title="' . esc_attr(sprintf(__('Preview &#8220;%s&#8221;'), $title)) . '" rel="permalink">' . __('Preview') . '</a>';
+			} else {
+				$actions['view'] = '<a href="' . get_permalink($page->ID) . '" title="' . esc_attr(sprintf(__('View &#8220;%s&#8221;'), $title)) . '" rel="permalink">' . __('View') . '</a>';
+			}
 		}
 		$actions = apply_filters('page_row_actions', $actions, $page);
 		$action_count = count($actions);
Index: wp-admin/post.php
===================================================================
--- wp-admin/post.php	(revision 11740)
+++ wp-admin/post.php	(working copy)
@@ -116,6 +116,7 @@
 	$post = get_post($post_ID);
 
 	if ( empty($post->ID) ) wp_die( __('You attempted to edit a post that doesn&#8217;t exist. Perhaps it was deleted?') );
+	if ( $post->post_status == 'deleted' ) wp_die( __('You can&#8217;t edit this post because it is in the Trash. Please move it out of the Trash and try again.') );
 
 	if ( 'post' != $post->post_type ) {
 		wp_redirect( get_edit_post_link( $post->ID, 'url' ) );
@@ -206,6 +207,23 @@
 	exit();
 	break;
 
+case 'undelete':
+	$post_id = (isset($_GET['post']))  ? intval($_GET['post']) : intval($_POST['post_ID']);
+	check_admin_referer('undelete-post_' . $post_id);
+
+	$post = & get_post($post_id);
+
+	if ( !wp_undelete_post($post_id) )
+		wp_die( __('Error in undeleting...') );
+
+	$sendback = wp_get_referer();
+	if (strpos($sendback, 'post.php') !== false) $sendback = admin_url('edit.php?undeleted=1');
+	elseif (strpos($sendback, 'attachments.php') !== false) $sendback = admin_url('attachments.php');
+	else $sendback = add_query_arg('undeleted', 1, $sendback);
+	wp_redirect($sendback);
+	exit();
+	break;
+
 case 'preview':
 	check_admin_referer( 'autosave', 'autosavenonce' );
 
Index: wp-admin/edit-page-form.php
===================================================================
--- wp-admin/edit-page-form.php	(revision 11740)
+++ wp-admin/edit-page-form.php	(working copy)
@@ -216,7 +216,7 @@
 <div id="delete-action">
 <?php
 if ( ( 'edit' == $action ) && current_user_can('delete_page', $post->ID) ) { ?>
-<a class="submitdelete deletion" href="<?php echo wp_nonce_url("page.php?action=delete&amp;post=$post->ID", 'delete-page_' . $post->ID); ?>" onclick="if ( confirm('<?php echo esc_js(sprintf( ('draft' == $post->post_status) ? __("You are about to delete this draft '%s'\n  'Cancel' to stop, 'OK' to delete.") : __("You are about to delete this page '%s'\n  'Cancel' to stop, 'OK' to delete."), $post->post_title )); ?>') ) {return true;}return false;"><?php _e('Delete'); ?></a>
+<a class="submitdelete deletion" href="<?php echo wp_nonce_url("page.php?action=delete&amp;post=$post->ID", 'delete-page_' . $post->ID); ?>"><?php _e('Move to Trash'); ?></a>
 <?php } ?>
 </div>
 
Index: wp-admin/edit-form-advanced.php
===================================================================
--- wp-admin/edit-form-advanced.php	(revision 11740)
+++ wp-admin/edit-form-advanced.php	(working copy)
@@ -229,7 +229,7 @@
 <div id="delete-action">
 <?php
 if ( ( 'edit' == $action ) && current_user_can('delete_post', $post->ID) ) { ?>
-<a class="submitdelete deletion" href="<?php echo wp_nonce_url("post.php?action=delete&amp;post=$post->ID", 'delete-post_' . $post->ID); ?>" onclick="if ( confirm('<?php echo esc_js(sprintf( ('draft' == $post->post_status) ? __("You are about to delete this draft '%s'\n  'Cancel' to stop, 'OK' to delete.") : __("You are about to delete this post '%s'\n  'Cancel' to stop, 'OK' to delete."), $post->post_title )); ?>') ) {return true;}return false;"><?php _e('Delete'); ?></a>
+<a class="submitdelete deletion" href="<?php echo wp_nonce_url("post.php?action=delete&amp;post=$post->ID", 'delete-post_' . $post->ID); ?>"><?php _e('Move to Trash'); ?></a>
 <?php } ?>
 </div>
 
Index: wp-admin/edit.php
===================================================================
--- wp-admin/edit.php	(revision 11740)
+++ wp-admin/edit.php	(working copy)
@@ -43,6 +43,20 @@
 				}
 			}
 			break;
+		case 'undelete':
+			if ( isset($_GET['post']) && ! isset($_GET['bulk_edit']) && (isset($_GET['doaction']) || isset($_GET['doaction2'])) ) {
+				check_admin_referer('bulk-posts');
+				$undeleted = 0;
+				foreach( (array) $_GET['post'] as $post_id ) {
+					$post_del = & get_post($post_id);
+
+					if ( !wp_undelete_post($post_id) )
+						wp_die( __('Error in undeleting...') );
+					
+					$undeleted++;
+				}
+			}
+			break;
 		case 'edit':
 			if ( isset($_GET['post']) && isset($_GET['bulk_edit']) ) {
 				check_admin_referer('bulk-posts');
@@ -70,6 +84,8 @@
 	}
 	if ( isset($deleted) )
 		$sendback = add_query_arg('deleted', $deleted, $sendback);
+	if ( isset($undeleted) )
+		$sendback = add_query_arg('undeleted', $undeleted, $sendback);
 	wp_redirect($sendback);
 	exit();
 } elseif ( isset($_GET['_wp_http_referer']) && ! empty($_GET['_wp_http_referer']) ) {
@@ -127,6 +143,11 @@
 	unset($_GET['deleted']);
 }
 
+if ( isset($_GET['undeleted']) && (int) $_GET['undeleted'] ) {
+	printf( _n( 'Post returned to Pending.', '%s posts returned to Pending.', $_GET['undeleted'] ), number_format_i18n( $_GET['undeleted'] ) );
+	unset($_GET['undeleted']);
+}
+
 $_SERVER['REQUEST_URI'] = remove_query_arg( array('locked', 'skipped', 'updated', 'deleted'), $_SERVER['REQUEST_URI'] );
 ?>
 </p></div>
@@ -139,7 +160,7 @@
 if ( empty($locked_post_status) ) :
 $status_links = array();
 $num_posts = wp_count_posts( 'post', 'readable' );
-$total_posts = array_sum( (array) $num_posts );
+$total_posts = array_sum( (array) $num_posts ) - $num_posts->deleted;
 $class = empty( $_GET['post_status'] ) ? ' class="current"' : '';
 $status_links[] = "<li><a href='edit.php' $class>" . sprintf( _nx( 'All <span class="count">(%s)</span>', 'All <span class="count">(%s)</span>', $total_posts, 'posts' ), number_format_i18n( $total_posts ) ) . '</a>';
 
@@ -192,8 +213,13 @@
 <div class="alignleft actions">
 <select name="action">
 <option value="-1" selected="selected"><?php _e('Bulk Actions'); ?></option>
+<?php if ($_GET['post_status'] == 'deleted') { ?>
+<option value="undelete"><?php _e('Return to Pending'); ?></option>
+<option value="delete"><?php _e('Delete Permanently'); ?></option>
+<?php } else { ?>
 <option value="edit"><?php _e('Edit'); ?></option>
-<option value="delete"><?php _e('Delete'); ?></option>
+<option value="delete"><?php _e('Move to Trash'); ?></option>
+<?php } ?>
 </select>
 <input type="submit" value="<?php esc_attr_e('Apply'); ?>" name="doaction" id="doaction" class="button-secondary action" />
 <?php wp_nonce_field('bulk-posts'); ?>
@@ -272,8 +298,13 @@
 <div class="alignleft actions">
 <select name="action2">
 <option value="-1" selected="selected"><?php _e('Bulk Actions'); ?></option>
+<?php if ($_GET['post_status'] == 'deleted') { ?>
+<option value="undelete"><?php _e('Return to Pending'); ?></option>
+<option value="delete"><?php _e('Delete Permanently'); ?></option>
+<?php } else { ?>
 <option value="edit"><?php _e('Edit'); ?></option>
-<option value="delete"><?php _e('Delete'); ?></option>
+<option value="delete"><?php _e('Move to Trash'); ?></option>
+<?php } ?>
 </select>
 <input type="submit" value="<?php esc_attr_e('Apply'); ?>" name="doaction2" id="doaction2" class="button-secondary action" />
 <br class="clear" />
Index: wp-admin/page.php
===================================================================
--- wp-admin/page.php	(revision 11740)
+++ wp-admin/page.php	(working copy)
@@ -83,6 +83,7 @@
 	$post = get_post_to_edit($page_ID);
 
 	if ( empty($post->ID) ) wp_die( __('You attempted to edit a page that doesn&#8217;t exist. Perhaps it was deleted?') );
+	if ( $post->post_status == 'deleted' ) wp_die( __('You can&#8217;t edit this page because it is in the Trash. Please move it out of the Trash and try again.') );
 
 	if ( 'page' != $post->post_type ) {
 		wp_redirect( get_edit_post_link( $post_ID, 'url' ) );
@@ -165,6 +166,23 @@
 	exit();
 	break;
 
+case 'undelete':
+	$post_id = (isset($_GET['post']))  ? intval($_GET['post']) : intval($_POST['post_ID']);
+	check_admin_referer('undelete-page_' . $post_id);
+
+	$post = & get_post($post_id);
+
+	if ( !wp_undelete_post($post_id) )
+		wp_die( __('Error in undeleting...') );
+
+	$sendback = wp_get_referer();
+	if (strpos($sendback, 'page.php') !== false) $sendback = admin_url('edit.php?undeleted=1');
+	elseif (strpos($sendback, 'attachments.php') !== false) $sendback = admin_url('attachments.php');
+	else $sendback = add_query_arg('undeleted', 1, $sendback);
+	wp_redirect($sendback);
+	exit();
+	break;
+
 case 'preview':
 	check_admin_referer( 'autosave', 'autosavenonce' );
 
Index: wp-admin/edit-pages.php
===================================================================
--- wp-admin/edit-pages.php	(revision 11740)
+++ wp-admin/edit-pages.php	(working copy)
@@ -35,6 +35,20 @@
 				}
 			}
 			break;
+		case 'undelete':
+			if ( isset($_GET['post']) && ! isset($_GET['bulk_edit']) && (isset($_GET['doaction']) || isset($_GET['doaction2'])) ) {
+				check_admin_referer('bulk-pages');
+				$undeleted = 0;
+				foreach( (array) $_GET['post'] as $post_id ) {
+					$post_del = & get_post($post_id);
+
+					if ( !wp_undelete_post($post_id) )
+						wp_die( __('Error in undeleting...') );
+					
+					$undeleted++;
+				}
+			}
+			break;
 		case 'edit':
 			if ( isset($_GET['post']) && isset($_GET['bulk_edit']) ) {
 				check_admin_referer('bulk-pages');
@@ -79,7 +93,8 @@
 		'future' => array(_x('Scheduled', 'page'), __('Scheduled pages'), _nx_noop('Scheduled <span class="count">(%s)</span>', 'Scheduled <span class="count">(%s)</span>', 'page')),
 		'pending' => array(_x('Pending Review', 'page'), __('Pending pages'), _nx_noop('Pending Review <span class="count">(%s)</span>', 'Pending Review <span class="count">(%s)</span>', 'page')),
 		'draft' => array(_x('Draft', 'page'), _x('Drafts', 'manage posts header'), _nx_noop('Draft <span class="count">(%s)</span>', 'Drafts <span class="count">(%s)</span>', 'page')),
-		'private' => array(_x('Private', 'page'), __('Private pages'), _nx_noop('Private <span class="count">(%s)</span>', 'Private <span class="count">(%s)</span>', 'page'))
+		'private' => array(_x('Private', 'page'), __('Private pages'), _nx_noop('Private <span class="count">(%s)</span>', 'Private <span class="count">(%s)</span>', 'page')),
+		'deleted' => array(_x('Trash', 'page'), __('Trash pages'), _nx_noop('Trash <span class="count">(%s)</span>', 'Trash <span class="count">(%s)</span>', 'page'))
 	);
 
 $post_stati = apply_filters('page_stati', $post_stati);
@@ -150,7 +165,7 @@
 if ( empty($locked_post_status) ) :
 $status_links = array();
 $num_posts = wp_count_posts('page', 'readable');
-$total_posts = array_sum( (array) $num_posts );
+$total_posts = array_sum( (array) $num_posts ) - $num_posts->deleted;
 $class = empty($_GET['post_status']) ? ' class="current"' : '';
 $status_links[] = "<li><a href='edit-pages.php'$class>" . sprintf( _nx( 'All <span class="count">(%s)</span>', 'All <span class="count">(%s)</span>', $total_posts, 'pages' ), number_format_i18n( $total_posts ) ) . '</a>';
 foreach ( $post_stati as $status => $label ) {
@@ -214,8 +229,13 @@
 <div class="alignleft actions">
 <select name="action">
 <option value="-1" selected="selected"><?php _e('Bulk Actions'); ?></option>
+<?php if ($_GET['post_status'] == 'deleted') { ?>
+<option value="undelete"><?php _e('Return to Pending'); ?></option>
+<option value="delete"><?php _e('Delete Permanently'); ?></option>
+<?php } else { ?>
 <option value="edit"><?php _e('Edit'); ?></option>
-<option value="delete"><?php _e('Delete'); ?></option>
+<option value="delete"><?php _e('Move to Trash'); ?></option>
+<?php } ?>
 </select>
 <input type="submit" value="<?php esc_attr_e('Apply'); ?>" name="doaction" id="doaction" class="button-secondary action" />
 <?php wp_nonce_field('bulk-pages'); ?>
@@ -253,8 +273,13 @@
 <div class="alignleft actions">
 <select name="action2">
 <option value="-1" selected="selected"><?php _e('Bulk Actions'); ?></option>
+<?php if ($_GET['post_status'] == 'deleted') { ?>
+<option value="undelete"><?php _e('Return to Pending'); ?></option>
+<option value="delete"><?php _e('Delete Permanently'); ?></option>
+<?php } else { ?>
 <option value="edit"><?php _e('Edit'); ?></option>
-<option value="delete"><?php _e('Delete'); ?></option>
+<option value="delete"><?php _e('Move to Trash'); ?></option>
+<?php } ?>
 </select>
 <input type="submit" value="<?php esc_attr_e('Apply'); ?>" name="doaction2" id="doaction2" class="button-secondary action" />
 </div>
