Skip to content

Instantly share code, notes, and snippets.

@techjewel
Last active December 31, 2023 15:13
Show Gist options
  • Star 4 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save techjewel/1bbb34d258c9ccd8b9d3a51afb9b61f7 to your computer and use it in GitHub Desktop.
Save techjewel/1bbb34d258c9ccd8b9d3a51afb9b61f7 to your computer and use it in GitHub Desktop.
Add Attachment to the email notification programatically in Fluent Forms.
<?php
/*
* Add Attachment to the email notification dynamically.
* @param $attachments array - Array of the attachments.
* @param $notification array - Email Notification array
* @param $form object - The Form Object
* @param $data array - The input submission data
* @return array
*/
add_filter('fluentform_filter_email_attachments', function ($attachments, $notification, $form, $data) {
/*
* You can check if $form or $notification and based on that push your file.
*/
$pathToYourFile = WP_CONTENT_DIR.'YOURFILE_PATH/file.pdf'; // Add path to your file
$attachments[] = $pathToYourFile; //
return $attachments;
}, 10, 4);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment