The Community forums are being phased out in favor of a new Slack group.
Add your email address below to get an invitation to join the community slack group
Add multiple emails to drop the attachment from in this snippet
Does anyone know how to add multiple emails to drop the attachment from in this snippet? I have about 20 emails I do not want the attachment sent to, and one I do want it sent to.
add_filter('frm_notification_attachment', 'remove_my_attachment', 10, 3);
function remove_my_attachment($attachments, $form, $args) {
if ( $args['email_key'] == 1277 ) { //change 1277 to the email ID that you would like to DROP the attachment for
$attachments = array(); //remove all attachments
}
return $attachments;
}
March 18, 2018 at 5:15 am
The easiest way to do this is to test for the one you want and drop the rest. Let's say the one you want to keep in the code above is 1277, then logically, all the others are not equal to 1277, right? Change the code above to not equal by including the logical not:
if ( $args['email_key'] !== 1277 )
March 18, 2018 at 11:55 am
Thank you. This is what I wanted to know. I am clueless when it comes to coding. I will give it a try.
Discussion closed.