I use a subclass of the list table class in my plugin to list logged mails. You can select multiple mails to resend or delete. The form data is send to the same page again.

The entries are sortable. This means for the header columns links are created by appending the orderby and order GET-parameters (base class behavior) to the current url.

Select a mail and action resend. Before actions:



After page submitted and actions handled:


But I expect no 'action', 'action1', 'email' arguments in the url anymore.

The link after the actions are processed contains the 'action' param. This means if you change the order of the columns the mail is resend over and over again (this makes no sense). The url also grows and results in a URI too long webserver-error (in case of apache) after some time of usage. How can I avoid this behavior?

1 Answer 1


Let me start with a question: What if the user simply refreshes the page after the action is processed? It will resubmit the action.

So the issue is not only with the links for the sortable column header and how WP_List_Table is generating them but with the way you are handling the action requests.

The best practice is to redirect the user back to a URL excluding the action parameter after processing the action, and have the page rendered on the second request instead of rendering it on the action request.

For example:

  1. User starts here: admin.php?page=wpml_plugin_log
  2. User sends a request to admin.php?page=wpml_plugin_log&action=delete&id=123
  3. Delete action is handled
  4. User is redirected back to admin.php?page=wpml_plugin_log&delete_success=123

As you see above, you may also add some other parameters (delete_success) to the redirect URL to pass the state of the handled action to the second request.

  • The redirect is what I came up with too (appeding only order, orderby, paged, s etc but not the actions). I did not find a appropriate location to do this redirect. If i try a redirect in the process_bulk_actions I get the error that the headers already sent. Do you know a plugin that implements this so I can look at the code?
    – No3x
    Oct 17, 2017 at 8:24
  • @No3x You can handle it in load-{$page_hook} action which fires before including the admin-header.php.
    – Parham
    Oct 17, 2017 at 14:53
  • I can't redirect there because then no action is exectued.
    – No3x
    Oct 17, 2017 at 15:14
  • Why not? I guess you are calling your process_bulk_actions() in your list class' prepare_items() method, right? That is not necessarily the appropriate place to handle the actions. Call your process_bulk_actions() in load-{$page_hook} action hook instead. @No3x
    – Parham
    Oct 17, 2017 at 15:43
  • Also see here for another solution using the admin_action_{$action} hook: wordpress.stackexchange.com/questions/10500/…
    – Parham
    Oct 17, 2017 at 15:45

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.