added checking for invalid ratings while saving
This commit is contained in:
parent
6d973b98b6
commit
eccd74b71d
|
@ -65,7 +65,7 @@ class WC_Admin_Meta_Boxes {
|
|||
add_action( 'woocommerce_process_shop_coupon_meta', 'WC_Meta_Box_Coupon_Data::save', 10, 2 );
|
||||
|
||||
// Save Rating Meta Boxes.
|
||||
add_filter( 'wp_update_comment_data', 'WC_Meta_Box_Product_Reviews::save', 1, 2 );
|
||||
add_filter( 'wp_update_comment_data', 'WC_Meta_Box_Product_Reviews::save', 1 );
|
||||
|
||||
// Error handling (for showing errors from meta boxes on next page load).
|
||||
add_action( 'admin_notices', array( $this, 'output_errors' ) );
|
||||
|
|
|
@ -50,6 +50,10 @@ class WC_Meta_Box_Product_Reviews {
|
|||
return $data;
|
||||
}
|
||||
|
||||
if ( $_POST['rating'] > 5 || $_POST['rating'] < 0 ) {
|
||||
return $data;
|
||||
}
|
||||
|
||||
$comment_id = $data['comment_ID'];
|
||||
|
||||
// Update meta
|
||||
|
|
Loading…
Reference in New Issue