• I’m using wpcf7_form_tag action hook to add a text inside textarea field if page has a specific condition:

    add_action( 'wpcf7_form_tag', function($scanned_tag, $this_exec) {
        $product_id = get_query_var('product_id', false);
    
        if ($product_id) {
            if($scanned_tag['basetype'] == 'textarea') {
                $text = 'sample text';
                $scanned_tag['values'][0] = $text;
            }
        }
    
        return $scanned_tag;
    }, 10, 2);

    The problem is that after sending the message, the textarea field is not cleared. The text is still there.

  • The topic ‘Clear textarea with default value after submit’ is closed to new replies.