Advertisement
valeraplusplus

CF7 чтобы файлы тоже приходили на почту.

Jun 15th, 2023
851
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.58 KB | Fixit | 0 0
  1. function cf7_attachment_link($wpcf7) {
  2.    $submission = WPCF7_Submission::get_instance();
  3.    if ($submission) {
  4.       $uploaded_files = $submission->uploaded_files();
  5.       if (!empty($uploaded_files)) {
  6.          $attachments = array();
  7.          foreach ($uploaded_files as $fieldname => $uploaded_file) {
  8.             $attachments[] = $uploaded_file;
  9.          }
  10.          $mail = $wpcf7->prop('mail');
  11.          $mail['attachments'] = $attachments;
  12.          $wpcf7->set_properties(array('mail' => $mail));
  13.       }
  14.    }
  15. }
  16. add_action('wpcf7_before_send_mail', 'cf7_attachment_link');
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement