Skip to content
Docs
Get RestroPress

Action

rpress_email_template_{$template}

Updated
On this page

Fires in place of the body template part when an action exists for the current email template.

Runs in RPRESS_Emails::build_email() in HTML mode, after rpress_email_header. If has_action() finds a callback for rpress_email_template_ followed by the current template slug, that action runs instead of the emails/body template part. Use it to render a fully custom body for a custom template registered with rpress_email_templates.

Example#

function my_compact_email_body() {
	echo '<div class="compact-body">{email}</div>';
}
add_action( 'rpress_email_template_compact', 'my_compact_email_body' );

Notes#

The template slug comes from RPRESS_Emails::get_template(). The {email} placeholder marks where the message text is inserted. No arguments are passed to the callback.

Source#

Fired from:

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

See also#

Was this page helpful?