DEV Community

mhsohag11
mhsohag11

Posted on

Answer: Modify Contact Form 7 Submission Data

I believe you can just use:

// define the wpcf7_posted_data callback 
function action_wpcf7_posted_data( $array ) { 
    //'checkbox-name' is the name that you gave the field in the CF7 admin.
    $value = $array['checkbox-name'];
    if( !empty( $value ) ){
        $array['checkbox-name'] = "New Value";
    }

    return $array;
}; 
add_filter( 'wpcf7_posted_data', 'action_wpcf7_posted_data', 10, 1

Top comments (0)