I am trying to enlist all my posts on the front-end along with delete and edit links (using the shortcode API). I am having difficulty with the delete links. To me the most obvious way to handle deletion is to use query variables and $_GET for deletion. However, if the user keeps reloading the page, WordPress will try to delete the post on every page load.
Another solution that comes to mind is to make each delete link a button and embed it in a form along with hidden fields containing post id and nonce etc. However this could potentially result in hundreds of form elements and an even higher number of hidden fields on a single page, which seems messy.
The last solution that I can think of is to use redirection. I could use query variables but intercept the page load, delete the post and redirect the user to the page without the query variables. However I can't seem to find the right hook for this. I want my function to run early enough so that I don't get any "headers already sent" messages.
I'd like to know which method is the correct one? And is there a hook that I can use for that last solution (something like the load hook but for the front-end).