WC_Comments::update_comment_type
Update comment type of product reviews.
Метод класса: WC_Comments{}
Хуков нет.
Возвращает
array.
Использование
$result = WC_Comments::update_comment_type( $comment_data );
- $comment_data(массив) (обязательный)
- Comment data.
Список изменений
| С версии 3.5.0 | Введена. |
Код WC_Comments::update_comment_type() WC Comments::update comment type WC 11.2.2
public static function update_comment_type( $comment_data ) {
if ( ! is_admin() && isset( $_POST['comment_post_ID'], $comment_data['comment_type'] ) && self::is_default_comment_type( $comment_data['comment_type'] ) && 'product' === get_post_type( absint( $_POST['comment_post_ID'] ) ) ) { // phpcs:ignore WordPress.Security.NonceVerification.Missing -- Anonymous product reviews are submitted through the core comment form, which carries no WooCommerce nonce; the post ID is read through absint().
$comment_data['comment_type'] = 'review';
}
return $comment_data;
}