Created
July 29, 2015 10:11
-
-
Save goliver79/506ed0c701d286b6dae6 to your computer and use it in GitHub Desktop.
[WORDPRESS] Contact Form 7. Edit mail data before send
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// define the wpcf7_mail_components callback | |
function filter_wpcf7_mail_components( $components, $number ) | |
{ | |
/* | |
$components = compact( 'subject', 'sender', 'body', | |
'recipient', 'additional_headers', 'attachments' ); | |
*/ | |
// make filter magic happen here... | |
$components[ 'subject' ] = 'New subject changed in filter'; | |
return $components; | |
}; | |
// add the filter | |
add_filter( 'wpcf7_mail_components', 'filter_wpcf7_mail_components', 10, 2 ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
More details https://docs.wpdebuglog.com/plugin/contact-form-7/5.1.7/filter/wpcf7_mail_components/