Skip to content

Commit bb41bbf

Browse files
committed
add empty array fallback to prevent warning in php log
1 parent bcea372 commit bb41bbf

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

sample-code-snippets/integrations/contact-form-7/forwarding-cf7-checkboxes-to-mailchimp.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,10 @@
88
* This code takes the checkbox named CHECKBOX1 from the CF7 form, and translates it to a semicolon separated string and send that to the Mailchimp field MMERGE8
99
*
1010
* Change MMERGE8 to your Mailchimp field and CHECKBOX1 to your CF7 field.
11+
* The checkbox name in CF7 still needs the mc4wp- prefix, eg mc4wp-checkbox-1
1112
*/
1213

1314
add_filter( 'mc4wp_integration_contact-form-7_data', function( $data ) {
14-
$data['MMERGE8'] = join( ';', $data['CHECKBOX1'] );
15-
unset($data['CHECKBOX1']);
15+
$data['MMERGE8'] = join( ';', $data['CHECKBOX-1'] ?? [] );
1616
return $data;
1717
});

0 commit comments

Comments
 (0)