Forked from strangerstudios/my_pmpro_email_attachments.php
Last active
August 7, 2025 18:43
-
-
Save MaryOJob/fd1380369201e0672670c16219d48f24 to your computer and use it in GitHub Desktop.
Add an attachment to confirmation emails after checkout in Paid Memberships Pro
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php // do not copy this line | |
| /* | |
| *Add an attachment to PMPro confirmation emails. | |
| */ | |
| function my_pmpro_email_attachments($attachments, $email) | |
| { | |
| //make sure it's a checkout email (but not the admin one) | |
| if(strpos($email->template, "checkout_") !== false && strpos($email->template, "admin") === false) | |
| { | |
| //make sure attachments is an array | |
| if(is_array($attachments)) | |
| $attachments = array(); | |
| //add our attachment | |
| $attachments[] = ABSPATH . "/wp-content/uploads/2014/09/Picture1.jpg"; // replace this URL with the link to your PDF file to attach | |
| } | |
| return $attachments; | |
| } | |
| add_filter('pmpro_email_attachments', 'my_pmpro_email_attachments', 10, 2); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment