Check if comment_type is empty

This commit is contained in:
Claudio Sanches 2018-09-10 18:40:46 -03:00
parent 18f8a51cc7
commit ead415e4b8
1 changed files with 1 additions and 1 deletions

View File

@ -417,7 +417,7 @@ class WC_Comments {
* @return array * @return array
*/ */
public static function update_comment_type( $comment_data ) { public static function update_comment_type( $comment_data ) {
if ( ! is_admin() && isset( $_POST['comment_post_ID'] ) && 'product' === get_post_type( absint( $_POST['comment_post_ID'] ) ) ) { // WPCS: input var ok, CSRF ok. if ( ! is_admin() && isset( $_POST['comment_post_ID'], $comment_data['comment_type'] ) && '' === $comment_data['comment_type'] && 'product' === get_post_type( absint( $_POST['comment_post_ID'] ) ) ) { // WPCS: input var ok, CSRF ok.
$comment_data['comment_type'] = 'review'; $comment_data['comment_type'] = 'review';
} }