Skip to content
Docs
Get RestroPress

Filter

rpress_admin_order_notification_attachments

Updated
On this page

Filters the file attachments sent with the admin order notification.

Runs in rpress_admin_email_notice before the admin email is sent. The default is an empty array. Return absolute file paths to attach to the notification.

Parameters#

ParameterTypeDescription
$attachmentsarrayList of file paths to attach. Empty by default.
$payment_idintID of the order.
$payment_dataarrayOrder meta passed to the admin notice.

Return value#

array. The list of attachment file paths.

Example#

function my_admin_notification_attachments( $attachments, $payment_id, $payment_data ) {
	$file = WP_CONTENT_DIR . '/uploads/tickets/order-' . absint( $payment_id ) . '.pdf';
	if ( file_exists( $file ) ) {
		$attachments[] = $file;
	}
	return $attachments;
}
add_filter( 'rpress_admin_order_notification_attachments', 'my_admin_notification_attachments', 10, 3 );

Source#

Applied in:

  • includes/emails/functions.php (line 134), in rpress_admin_email_notice()

See also#

Was this page helpful?