I have the following link which allows an author to delete a post on my site but I need it to redirect to the home page afterwards because at the moment it tries to take the user to the post itself which of cause will throw a 404 as it no longer exists (not very user-friendly)
Here is the code: <p id="delete"><a title="Delete your Favor?" href="<?php echo get_delete_post_link( $post->ID ); ?>">Delete your Favor?</a></p>
How can I modify it to redirect to the homepage?
According to the WordPress 3.0.4 source code (wp-admin/post.php, line 223), going through that link calls the wp_trash_post function.
That function finishes by triggering a trashed_post action (wp-includes/post.php line 1838).
You can hook up your own handler to the trashed_post action (with add_action) and do a wp_redirect.
Easiest way to do this: Your theme should have a functions.php file.
Add this to it: