+ check_admin_referer('update-post_' . $post_id);
+
+ $post_id = edit_post();
+
+ // Session cookie flag that the post was saved
+ if ( isset( $_COOKIE['wp-saving-post-' . $post_id] ) )
+ setcookie( 'wp-saving-post-' . $post_id, 'saved' );
+
+ redirect_post($post_id); // Send user on their way while we keep working
+
+ exit();
+ break;
+
+case 'trash':
+ check_admin_referer('trash-post_' . $post_id);
+
+ if ( ! $post )
+ wp_die( __( 'The item you are trying to move to the Trash no longer exists.' ) );
+
+ if ( ! $post_type_object )
+ wp_die( __( 'Unknown post type.' ) );
+
+ if ( ! current_user_can( 'delete_post', $post_id ) )
+ wp_die( __( 'You are not allowed to move this item to the Trash.' ) );
+
+ if ( $user_id = wp_check_post_lock( $post_id ) ) {
+ $user = get_userdata( $user_id );
+ wp_die( sprintf( __( 'You cannot move this item to the Trash. %s is currently editing.' ), $user->display_name ) );
+ }
+
+ if ( ! wp_trash_post( $post_id ) )
+ wp_die( __( 'Error in moving to Trash.' ) );
+
+ wp_redirect( add_query_arg( array('trashed' => 1, 'ids' => $post_id), $sendback ) );
+ exit();
+ break;
+
+case 'untrash':
+ check_admin_referer('untrash-post_' . $post_id);
+
+ if ( ! $post )
+ wp_die( __( 'The item you are trying to restore from the Trash no longer exists.' ) );