$untrashed = 0;
if ( isset( $_GET['doaction'
] ) && ( 'undo' ===
$_GET['doaction'
] ) ) { add_filter( 'wp_untrash_post_status', 'wp_untrash_post_set_previous_status', 10, 3
);
} foreach ( (array) $post_ids as $post_id ) { if ( !
current_user_can( 'delete_post',
$post_id ) ) { wp_die( __( 'Sorry, you are not allowed to restore this item from the Trash.'
) );
} if ( !
wp_untrash_post( $post_id ) ) { wp_die( __( 'Error in restoring the item from Trash.'
) );
} $untrashed++;
} $sendback =
add_query_arg( 'untrashed',
$untrashed,
$sendback );
remove_filter( 'wp_untrash_post_status', 'wp_untrash_post_set_previous_status', 10
);
break;
case 'delete':