- $location = add_query_arg('message', 2, $location);
- $location = remove_query_arg('posted', $location);
- wp_redirect($location);
- exit;
+ if ( !wp_trash_post($post_id) )
+ wp_die( __('Error in moving to trash...') );
+ }
+ $location = add_query_arg( array( 'message' => 4, 'ids' => join(',', $post_ids) ), $location );
+ break;
+ case 'untrash':
+ foreach( (array) $post_ids as $post_id ) {
+ if ( !current_user_can('delete_post', $post_id) )
+ wp_die( __('You are not allowed to move this post out of the trash.') );
+
+ if ( !wp_untrash_post($post_id) )
+ wp_die( __('Error in restoring from trash...') );
+ }
+ $location = add_query_arg('message', 5, $location);
+ break;
+ case 'delete':
+ foreach( (array) $post_ids as $post_id_del ) {
+ if ( !current_user_can('delete_post', $post_id_del) )
+ wp_die( __('You are not allowed to delete this post.') );
+
+ if ( !wp_delete_attachment($post_id_del) )
+ wp_die( __('Error in deleting...') );
+ }
+ $location = add_query_arg('message', 2, $location);
+ break;