Description
Use to display the custom mail tags to the Google Sheet Pro tab of Contact Form 7 settings and fetch the values using CF7 hook “wpcf7_special_mail_tags” to the google sheet.
Usage
add_filter( “gscf7_special_mail_tags”, “add_custom_mail_tag”, 10, 2 );
Parameters
- $custom_mail_tags : An array to pass the custom mail tag name example “_current_url”.
- $form_id : Contact Form 7 form id.
Example
add_filter( "gscf7_special_mail_tags", "add_custom_mail_tag", 10, 2 ); function add_custom_mail_tag( $custom_mail_tags, $form_id ) { $custom_mail_tags[] = "_current_url"; return $custom_mail_tags; }
To pass values to the Google Sheet, use CF7 hook as following :
add_filter("wpcf7_special_mail_tags", function( $output, $name, $html ) { if ( $name === "_current_url" ) { return "http://$_SERVER[HTTP_HOST]$_SERVER[REQUEST_URI]"; } return $output; }, 10, 3 );
Output for above example :
http://demo.gsheetconnector.com/wp-json/contact-form-7/v1/contact-forms/137/feedback