As you may have guessed WordPress deals differently with threaded comments. By default the comment reply link is generated by the get_comment_reply_link
function and the comment form with the send-button by comment_form
.
If your theme supports threaded comments it adds the comment-reply
script. This script moves around the comment form to the (threaded) comment that the user wishes to reply to. In the process it needs to change the POST call, else the server won’t know to which comment to attach the reply. Your scenario is not taken into account and the script has no hooks.
So, this leaves you two options. One is to write your own script. The other, more feasible one is to intercept the POST call, like you have done for regular comments, with the comment_post_redirect
hook (which is bypassed when the form is submitted by the script). Here’s what I would do roughly:
- Add a hidden field to the comment form, but ONLY when the form is shown on the front page.
- Intercept the POST call and look for the hidden field (you can access the $_POST variable which contains the submitted info)
- If the hidden field is there, use
wp_redirect
to send users to the home page