我只想接受注册用户对我的产品的评分。我不想要评论字段。我尝试删除字段,但此字段有一些验证。我不知道如何删除此验证。谢谢。
8yparm6h1#
add_filter( 'woocommerce_product_tabs', 'wcs_woo_remove_reviews_tab', 98 ); function wcs_woo_remove_reviews_tab($tabs) { unset($tabs['reviews']); return $tabs; }
disbfnqx2#
function remove_comment_form_field($comment_form) { $comment_form['comment_field'] = ''; if ( wc_review_ratings_enabled() ) { $comment_form['comment_field'] = '<div class="comment-form-rating"><label for="rating">' . esc_html__( 'Your rating', 'woocommerce' ) . ( wc_review_ratings_required() ? ' <span class="required">*</span>' : '' ) . '</label><select name="rating" id="rating" required> <option value="">' . esc_html__( 'Rate…', 'woocommerce' ) . '</option> <option value="5">' . esc_html__( 'Perfect', 'woocommerce' ) . '</option> <option value="4">' . esc_html__( 'Good', 'woocommerce' ) . '</option> <option value="3">' . esc_html__( 'Average', 'woocommerce' ) . '</option> <option value="2">' . esc_html__( 'Not that bad', 'woocommerce' ) . '</option> <option value="1">' . esc_html__( 'Very poor', 'woocommerce' ) . '</option> </select></div>'; } return $comment_form; } add_filter('woocommerce_product_review_comment_form_args', 'remove_comment_form_field'); add_filter('allow_empty_comment', '__return_true');
2条答案
按热度按时间8yparm6h1#
disbfnqx2#