Which method to use when deleting posts from the front-end

There are two more possible ways

  1. Use the browser’s history API to manipulate the URL displayed at the address bar/ history.

  2. Use AJAX

Redirection is the best solution for 100% browser support and it is probably the easiest to implement. You don’t need to use any hook with that just do the processing without generating output and then redirect back to the page. Something like

if (isset($GET['posttodelete'])) {
  delete post
  wp_redirect(utl with 'posttodelete' stripped out of it);
} else 
  normal loop;

But your users might prefer the AJAX solution which requires much more coding but gives the best user experience.

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)