Leave a Reply

1 comment

  1. You can use the function update_user_meta for logged in users and the php function setcookie for the visitors. Here is a start how to work with update_user_meta

    You can run this function on submission of the form or by running it by AJAX, i would recommend you to run it with AJAX.

    function wpse_update_user_commentform() {
    
        /**
         * Get values from the selected
         * Dropdown as tha variable $side
         * Change this to your dropdown name
        */
    
        $side = $_POST['dropdown'];
    
        $comment_id = get_comment_ID();
    
        // Update the comment meta "comment_side" to the selected value
        update_comment_meta( $comment_id, 'comment_side', $side );
    
    }