Redirect back to origin page after using get_delete_post_link()

Question

I need to implement frontend and backend redirection after delete specific post using get_delete_post_link(). Which hook i can use? Any advice would be appreciated.

Something similar to :

<?php echo wp_login_url( $redirect ); ?>

I need to redirect to front-end page after post deleted, similar to wp_login_url can do.

As Barry said my code might look like below:

add_filter( 'get_delete_post_link', 'some_function', 20 );
function some_function() {
  wp_redirect( get_permalink() );
  exit;
}

Assume get_permalink will get current page where get_delete_post_link called.
Any better way for this?

0
, , , Ivan Slaughter 4 months 0 Answers 54 views 0

Leave an answer