I am displaying custom data in wp_list_table. I was able to display the data correctly in the table. Now I want to add this functionality: when I click on the delete button by hovering on the row or else selecting the checkbox for multiple deletes, I want to move items to trash. When permanently deleting an item, that row should be deleted from the table. How can I achieve this? I am grateful for any help.
How to do a single delete and bulk delete action in wp_list_table in wordpress?
2k Views Asked by Abhee At
3
There are 3 best solutions below
1

Go to the path /wp-admin/includes/class-wp-list-table.php Check file find function bulk_actions() all
0

Always use the id for the entry in your view to enable edits.
Use the id to delete single or multiple entries of your data.
Track the 'delete'-click and use
$wpdb->query("DELETE FROM $table_name WHERE id IN($ids)");
For details see two issues on stack exchange for further information.
Really detailed about the necessary parts.
for guys like me who stumbled on this page for the same question, after a little search I found out that the code for trash & delete permanently actions,is splitted between two files: