Created
October 18, 2019 07:38
-
-
Save campusboy87/7bd90bb4b54bd3392ad601ca87f1a97d to your computer and use it in GitHub Desktop.
CF7: Добавляет заголовок формы в конец шаблона письма при отправке
This file contains 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 | |
add_action( 'wpcf7_before_send_mail', 'wpcf7_add_title_form_to_mail_body' ); | |
/** | |
* @param WPCF7_ContactForm $contact_form | |
*/ | |
function wpcf7_add_title_form_to_mail_body( $contact_form ) { | |
$form_title = $contact_form->title(); | |
$form_mail = $contact_form->prop( 'mail' ); | |
$form_mail['body'] .= "\n\nНазвание формы: $form_title"; | |
$contact_form->set_properties( [ 'mail' => $form_mail ] ); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment