WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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() );

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

share|improve this question

Theres a filter you can hook on to.

apply_filters( 'get_delete_post_link', wp_nonce_url( $delete_link, "$action-{$post->post_type}_{$post->ID}" ), $post->ID, $force_delete );

Check the raw function here: http://core.trac.wordpress.org/browser/tags/3.4.1/wp-includes/link-template.php#L954

Can't advise much else without seeing your code.


its nasty buy you can do

add_filter( 'get_delete_post_link', 'some_function', 20 );
function some_function() {
  wp_redirect( home_url('/') );
share|improve this answer
Question edited please advise, many thanks. – Ivan Slaughter Jul 15 '12 at 4:48
Wheres the rest of the code that includes your call to get_delete_post_link – Barry Carlyon Jul 15 '12 at 7:37

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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