Skip to content

Instantly share code, notes, and snippets.

@kjohnson
Created October 9, 2015 15:17
Show Gist options
  • Select an option

  • Save kjohnson/3ffddc907553fc6e4244 to your computer and use it in GitHub Desktop.

Select an option

Save kjohnson/3ffddc907553fc6e4244 to your computer and use it in GitHub Desktop.
<?php
/*
Plugin Name: Ninja Forms - Custom Attachment Filter
*/
add_filter( 'nf_email_notification_attachments', 'my_custom_attachment', 9001, 2 );
function my_custom_attachment( $attachments, $action_id ){
// TODO: Set your own ID for your action
// Confirm the Action ID is the intended email action.
if( '60' != $action_id ) return $attachments;
// TODO: Set your own file path for your attachment
// Create Attachment File Path
$file_path = WP_CONTENT_DIR . '/uploads/ninja-forms/-001.png';
// Push File Path to attachments array
$attachments[] = $file_path;
// Return the updated attachments array
return $attachments;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment