Skip to content

Actions and filters

Emails: 15 hooks.

14 of the 15 have a description in the source.

5 actions10 filters

filter

davo_email_attachments

Allow attachments to be modified (e.g. removed for size reasons) before sending.

Parameters of davo_email_attachments
ParameterTypeDescription
$attachmentsstring[]Absolute file paths, already filtered to existing/readable.
$tostringRecipient address.
$log_idintLog row ID.
add_filter
add_filter( 'davo_email_attachments', 'my_filter_callback', 10, 3 );

/**
 * @param string[] $attachments
 * @param string $to
 * @param int $log_id
 */
function my_filter_callback( $attachments, $to, $log_id ) {
	// Change $attachments as needed, then return it.
	return $attachments;
}

src/domains/emails/repository.php:507

filter

davo_email_contact_url

Filters the contact link in email footers. Defaults to the site address followed by /contact.

Parameters of davo_email_contact_url
ParameterTypeDescription
$urlstringContact page URL.

Returns string

add_filter
add_filter( 'davo_email_contact_url', 'my_filter_callback', 10, 1 );

/**
 * @param string $url
 */
function my_filter_callback( $url ) {
	// Change $url as needed, then return it.
	return $url;
}

src/domains/emails/templates.php:186

filter

davo_email_global_data

Allow global defaults to be overridden or extended.

Parameters of davo_email_global_data
ParameterTypeDescription
$defaultsarray<string, mixed>Default token values.
add_filter
add_filter( 'davo_email_global_data', 'my_filter_callback', 10, 1 );

/**
 * @param array<string, mixed> $defaults
 */
function my_filter_callback( $defaults ) {
	// Change $defaults as needed, then return it.
	return $defaults;
}

src/domains/emails/templates.php:398

filter

davo_email_headers

Allow the headers to be modified before sending.

Parameters of davo_email_headers
ParameterTypeDescription
$headersstring[]Mail headers.
$tostringRecipient address.
add_filter
add_filter( 'davo_email_headers', 'my_filter_callback', 10, 2 );

/**
 * @param string[] $headers
 * @param string $to
 */
function my_filter_callback( $headers, $to ) {
	// Change $headers as needed, then return it.
	return $headers;
}

src/domains/emails/repository.php:481

filter

davo_email_html_body

Allow the HTML body to be modified before sending.

Parameters of davo_email_html_body
ParameterTypeDescription
$htmlstringRendered HTML.
$tostringRecipient address.
$subjectstringEmail subject.
add_filter
add_filter( 'davo_email_html_body', 'my_filter_callback', 10, 3 );

/**
 * @param string $html
 * @param string $to
 * @param string $subject
 */
function my_filter_callback( $html, $to, $subject ) {
	// Change $html as needed, then return it.
	return $html;
}

src/domains/emails/repository.php:490

filter

davo_email_log_retention_days

Control the log retention period in days.

Parameters of davo_email_log_retention_days
ParameterTypeDescription
$daysintNumber of days to retain email logs (default 90).
add_filter
add_filter( 'davo_email_log_retention_days', 'my_filter_callback', 10, 1 );

/**
 * @param int $days
 */
function my_filter_callback( $days ) {
	// Change $days as needed, then return it.
	return $days;
}

src/domains/emails/initializer.php:148

filter

davo_email_logo_url

Filters the logo URL shown in email headers. Defaults to the site logo.

Parameters of davo_email_logo_url
ParameterTypeDescription
$urlstringLogo URL.

Returns string

add_filter
add_filter( 'davo_email_logo_url', 'my_filter_callback', 10, 1 );

/**
 * @param string $url
 */
function my_filter_callback( $url ) {
	// Change $url as needed, then return it.
	return $url;
}

src/domains/emails/templates.php:224

action

davo_email_queue_processed

Fires after a queue processing batch completes.

Parameters of davo_email_queue_processed
ParameterTypeDescription
$processedintTotal rows processed.
$sentintSuccessfully sent.
$failedintFailed sends.
add_action
add_action( 'davo_email_queue_processed', 'my_action_callback', 10, 3 );

/**
 * @param int $processed
 * @param int $sent
 * @param int $failed
 */
function my_action_callback( $processed, $sent, $failed ) {
	// Your code here.
}

src/domains/emails/repository.php:239

action

davo_email_queued

Fires when an email is added to the queue.

Parameters of davo_email_queued
ParameterTypeDescription
$log_idintLog row ID.
$tostringRecipient address.
$template_slugstringTemplate slug.
add_action
add_action( 'davo_email_queued', 'my_action_callback', 10, 3 );

/**
 * @param int $log_id
 * @param string $to
 * @param string $template_slug
 */
function my_action_callback( $log_id, $to, $template_slug ) {
	// Your code here.
}

src/domains/emails/repository.php:210

filter

davo_email_rendered

Allow third-party code to modify the rendered email parts before delivery.

Parameters of davo_email_rendered
ParameterTypeDescription
$resolvedarray<string, string>{ subject, html, text }
$slugstringTemplate slug.
$dataarray<string, mixed>Resolved data map.
add_filter
add_filter( 'davo_email_rendered', 'my_filter_callback', 10, 3 );

/**
 * @param array<string, string> $resolved
 * @param string $slug
 * @param array<string, mixed> $data
 */
function my_filter_callback( $resolved, $slug, $data ) {
	// Change $resolved as needed, then return it.
	return $resolved;
}

src/domains/emails/templates.php:122

action

davo_email_retried

Fires after a retry batch completes.

Parameters of davo_email_retried
ParameterTypeDescription
$retriedintTotal rows retried.
$sentintSuccessfully sent.
$failedintStill-failed.
add_action
add_action( 'davo_email_retried', 'my_action_callback', 10, 3 );

/**
 * @param int $retried
 * @param int $sent
 * @param int $failed
 */
function my_action_callback( $retried, $sent, $failed ) {
	// Your code here.
}

src/domains/emails/repository.php:261

action

davo_email_sent

Fires after an immediate email send attempt.

Parameters of davo_email_sent
ParameterTypeDescription
$log_idintLog row ID.
$tostringRecipient address.
$template_slugstringTemplate slug used.
$sentboolWhether the send succeeded.
add_action
add_action( 'davo_email_sent', 'my_action_callback', 10, 4 );

/**
 * @param int $log_id
 * @param string $to
 * @param string $template_slug
 * @param bool $sent
 */
function my_action_callback( $log_id, $to, $template_slug, $sent ) {
	// Your code here.
}

src/domains/emails/repository.php:135

filter

davo_email_support_url

Filters the support link in email footers. Defaults to the site address followed by /support.

Parameters of davo_email_support_url
ParameterTypeDescription
$urlstringSupport page URL.

Returns string

add_filter
add_filter( 'davo_email_support_url', 'my_filter_callback', 10, 1 );

/**
 * @param string $url
 */
function my_filter_callback( $url ) {
	// Change $url as needed, then return it.
	return $url;
}

src/domains/emails/templates.php:178

filter

davo_queue_email

The source has no description for this hook. It is called from Emails_Initializer::initialize().

Passed to callbacks: null$payload

add_filter
add_filter( 'davo_queue_email', 'my_filter_callback', 10, 2 );

function my_filter_callback( $arg1, $arg2 ) {
	// Change $arg1 as needed, then return it.
	return $arg1;
}

src/domains/emails/initializer.php:109, and 1 more place

action

davo_register_email_templates

Register custom email templates here.

Parameters of davo_register_email_templates
ParameterTypeDescription
$templatesEmails_TemplatesThe template registry instance. Example: add_action( 'davo_register_email_templates', function( $templates ) { $templates->register( 'my_custom', fn() => [ 'subject' => 'Hello from {{site_name}}', 'html' => '<p>Hi {{username}}!</p>', ] ); } );
add_action
add_action( 'davo_register_email_templates', 'my_action_callback', 10, 1 );

/**
 * @param Emails_Templates $templates
 */
function my_action_callback( $templates ) {
	// Your code here.
}

src/domains/emails/initializer.php:263

Note. Generated from the plugin source. Descriptions and parameters are the ones written in the code. The starter code uses the parameter names from those comments, or generic names where there are none, so check them against your use.

See it on your own site.

Davo is a WordPress theme and plugin by Exorex.

  • Runs on your own WordPress
  • Guided setup wizard
  • AI is off until you switch it on
  • Read the licence on the marketplace first