WooCommerce Review Author Hook on Review Submission

Found it!

Go to wp-includes > comment-templates.php.

Edit around line 2560:

else ( ! is_user_logged_in() ) {

to

else {

Then in my plugin .php file or your Theme ‘function.php’, add:

function modify_author($commentdata) {
  $commentdata['comment_author'] = $_POST['author']; // You should sanitize this.

  return $commentdata;
}
add_filter('preprocess_comment', 'modify_author');

I know it’s bad idea to modify comment-templates.php, but it’s working for me for now. Any ideas to show Guest Review Form through our own plugin would be appreciated. Thank you.

References: