WP_List_Table redirecting after action
-
Hello guys,
I’m having a little problem with WP_List_Table. I’ve been searching quite everywhere but seems to not find a good answer or I might be missing something.
So here is the deal, I have a child class of wp_list_table that I use to display data from a table in the database. Everything’s fine till there. I added actions on one of the column (view and delete) and added some views (unread, all). My problem is when I execute an action, let’s say delete for example, the link of the delete button is something like http://example.com/wp-admin/admin.php?page=mypage&action=delete&file=file_id and it takes me to that link (which is the same page but with argument added) and this triggers the action delete the file. The problem is, when I change view for example or go to the next page, wp_list_table (or at least my code) is just adding new arguments to the actual link which is “http://example.com/wp-admin/admin.php?page=mypage&action=delete&file=file_id” and become “http://example.com/wp-admin/admin.php?page=mypage&action=delete&file=file_id&customvar=unread” in case on view changing and that triggers an error because it is calling the delete action again on the files that no longer exist and I really don’t know how to get rid of this. Tried redirecting with wp_redirect but it send error “headers already sent” and I’m really lost right now if you guys could help me out with this.
Thank you in advance guys
The topic ‘WP_List_Table redirecting after action’ is closed to new replies.