Description
Filter hook to add attachments to emails sent through the WP-Members email function.
Parameters
$attachment
(string/array)(required) The path to an attachment.
$tag
(string)(optional) The email being sent (newreg|newmod|appmod|repass|admin).
Usage
// Example adding an attachement as a string:
add_filter( 'wpmem_email_attachments', function( $attachments, $tag ) {
if ( 'newreg' == $tag ) {
$upload_dir = wp_upload_dir();
$attachments = trailingslashit( $upload_dir['basedir'] ) . 'path/to/file/filename.pdf';
}
return $attachments;
}, 10, 2 );
// Example adding an attachment as an array:
add_filter( 'wpmem_email_attachments', function( $attachments, $tag ) {
if ( 'newreg' == $tag ) {
$upload_dir = wp_upload_dir();
$attachments[] = trailingslashit( $upload_dir['basedir'] ) . 'path/to/file/filename.pdf';
}
return $attachments;
}, 10, 2 );Changelog
- Introduced in 3.4.0
Source
wpmem_email_attachments is located in includes/class-wp-members-email.php