Skip to content
Docs
Get RestroPress

Filter

rpress_email_tags

Updated
On this page

Filters the list of email tag definitions before they are registered.

Runs when RestroPress registers its built-in email tags on the rpress_add_email_tags action. Each element is an array with the keys tag, description and function, where function is a callable that receives the payment ID and returns the replacement text. Add elements to register new tags such as {order_note}, or remove elements to drop a built-in tag.

Parameters#

ParameterTypeDescription
$email_tagsarrayList of arrays, each with the keys 'tag', 'description' and 'function'.

Return value#

array. The list of email tag definitions to register.

Example#

function my_add_email_tags( $email_tags ) {
	$email_tags[] = array(
		'tag'         => 'order_note',
		'description' => __( 'Custom note saved on the order', 'my-plugin' ),
		'function'    => 'my_email_tag_order_note',
	);
	return $email_tags;
}
add_filter( 'rpress_email_tags', 'my_add_email_tags', 10, 1 );

function my_email_tag_order_note( $payment_id ) {
	return esc_html( get_post_meta( $payment_id, '_my_order_note', true ) );
}

Source#

Applied in:

  • includes/emails/email-tags.php (line 229), in rpress_setup_email_tags()

See also#

Was this page helpful?