Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

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?

share|improve this question

1 Answer 1

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;
}
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

 
discard

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.