I added some field to wordpress commments and add below code for save them :

add_action ('comment_post', 'add_comment_bid_values', 1);
function add_comment_bid_values($comment_id) {
    if(isset($_POST['bidprice'])) {
        $bidprice = wp_filter_nohtml_kses($_POST['bidprice']);
        add_comment_meta($comment_id, 'bidprice', $bidprice, false);
    if(isset($_POST['bidday'])) {
        $bidday = wp_filter_nohtml_kses($_POST['bidday']);
        add_comment_meta($comment_id, 'bidday', $bidday, false);
    if(isset($_POST['bidprepay'])) {
        $bidprepay = wp_filter_nohtml_kses($_POST['bidprepay']);
        add_comment_meta($comment_id, 'bidprepay', $bidprepay, false);
    if(isset($_POST['bidsponsor'])) {
        $bidsponsor = wp_filter_nohtml_kses($_POST['bidsponsor']);
        add_comment_meta($comment_id, 'bidsponsor', $bidsponsor, false);
    if(isset($_POST['bidfetured'])) {
        $bidfetured = wp_filter_nohtml_kses($_POST['bidfetured']);
        add_comment_meta($comment_id, 'bidfetured', $bidfetured, false);


How i can sure that comment and it’s meta inserted into wordpress database, because some information save by comment_form function and this meta save by above code and also wordpress don’t have transaction .


Read more here: How can i sure that mysql statements done susseccfully in wordpress


If you know the solution of this issue, please leave us a reply in Comment section, to update the question.

Wordpress related questions and answers: