I have a hack that closes the WordPress popup comment window after the comment is submitted. However, it also attempts to close the window when a comment is made on a single post page because I am tying into the same filter that is used by both.
if( stripos($_SERVER['REQUEST_URI'], 'comments_popup') !== FALSE ) {
add_filter('comment_post_redirect', 'reload_blog_index');
function reload_blog_index(){
echo "<script type='text/javascript'>";
echo "window.close()";
echo "</script>";
}
}
As you can see above, I'm attempting to tell if the URL that referred the wp-comment-post file is coming from the popup comment window, but that seems to have no effect.
Any suggestions on a function that checks to see if comments_popup is in the referring URL string and only run this function in that instance?