Skip to content

Instantly share code, notes, and snippets.

@goliver79
Created July 29, 2015 10:11
Show Gist options
  • Save goliver79/506ed0c701d286b6dae6 to your computer and use it in GitHub Desktop.
Save goliver79/506ed0c701d286b6dae6 to your computer and use it in GitHub Desktop.
[WORDPRESS] Contact Form 7. Edit mail data before send
<?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 );
@arshidkv12
Copy link

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment