Skip to content
Docs
Get RestroPress

Filter

rpress_email_attachments

Updated
On this page

Filters the attachments passed to wp_mail for a RestroPress email.

Applied in RPRESS_Emails::send() after the message is built and just before wp_mail() is called. The value is the fourth argument given to send(), an empty string by default.

Parameters#

ParameterTypeDescription
$attachmentsstring|arrayAttachment file paths supplied to send(), or an empty string.
$emailsRPRESS_EmailsThe RPRESS_Emails instance sending the email.

Return value#

string|array. The attachment path or array of paths.

Example#

function my_email_attachments( $attachments, $emails ) {
	$attachments = (array) $attachments;
	$attachments[] = WP_CONTENT_DIR . '/uploads/terms.pdf';
	return array_filter( $attachments );
}
add_filter( 'rpress_email_attachments', 'my_email_attachments', 10, 2 );

Notes#

The default value is an empty string, so cast to array before appending.

Source#

Applied in:

  • includes/emails/class-rpress-emails.php (line 304), in RPRESS_Emails::send()

See also#

Was this page helpful?