More importantly you should notice what link is produced by get_delete_post_link()
. It’s an admin link is_admin()
check will be always true
. Instead you need something else that helps match the request. Try adding and query arg to your delete link.
add_query_arg( 'origin', 'fe', get_delete_post_link( get_the_ID() ) );
then in the action
add_action('deleted_post', 'woffice_trashed_post_handler', 10);
function woffice_trashed_post_handler($post_id) {
if( isset( $_POST['origin'] ) && $_POST['origin'] == 'fe' ) {
wp_redirect( get_option('siteurl') );
exit;
}
}