Skip to content

Instantly share code, notes, and snippets.

@ko31
Last active October 20, 2021 07:24
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ko31/6da92499cb783b12d9ad1e4907cf39ca to your computer and use it in GitHub Desktop.
Save ko31/6da92499cb783b12d9ad1e4907cf39ca to your computer and use it in GitHub Desktop.
How to replace the input values of a checkbox to the email body with a line break in Contact Form 7.
add_filter( 'wpcf7_mail_tag_replaced', function ( $replaced, $submitted, $html, $mail_tag ) {
// In this case, the value of "options" tag will be replaced.
if ( 'options' === $mail_tag->field_name() ) {
$replaced = implode( "\n", $submitted );
}
return $replaced;
}, 10, 4 );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment