Skip to content

Instantly share code, notes, and snippets.

@campusboy87
Created October 18, 2019 07:38
Show Gist options
  • Save campusboy87/7bd90bb4b54bd3392ad601ca87f1a97d to your computer and use it in GitHub Desktop.
Save campusboy87/7bd90bb4b54bd3392ad601ca87f1a97d to your computer and use it in GitHub Desktop.
CF7: Добавляет заголовок формы в конец шаблона письма при отправке
<?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