0

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?

1 Answer 1

0

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.

Edit:

its nasty buy you can do

add_filter( 'get_delete_post_link', 'some_function', 20 );
function some_function() {
  wp_redirect( home_url('/') );
  exit;
}
1
  • Wheres the rest of the code that includes your call to get_delete_post_link Commented Jul 15, 2012 at 7:37

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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