I'm calling a custom function when someone submits comments using the following to plug into the comment_post action: add_action('comment_post', 'MY_FUNCTION');
The problem is that my function is extremely heavy, causing about a 5 second delay between the time when someone submits a comment to the time when the page refreshes and they view their comment. Is there any way that my custom function could run in the background, so that they could be redirected right away? Alternatively, would it be safe to redirect them directly at the top of my function, then run the rest of my function after they had already been redirected?