WordPress at Your Fingertips
filter is not described

pre_wp_mail filter-hook . WP 5.7.0

Filters whether to preempt sending an email.

Returning a non-null value will short-circuit wp_mail(), returning that value instead. A boolean return value should be used to indicate whether the email was successfully sent.


add_filter( 'pre_wp_mail', 'filter_function_name_8685', 10, 2 );
function filter_function_name_8685( $return, $atts ){
	// filter...

	return $return;
Short-circuit return value.

Array of the wp_mail() arguments.

  • to(string|string[])
    Array or comma-separated list of email addresses to send message.

  • subject(string)
    Email subject.

  • message(string)
    Message contents.

  • headers(string|string[])
    Additional headers.

  • attachments(string|string[])
    Paths to files to attach.


Since 5.7.0 Introduced.

Where the hook is called

wp-includes/pluggable.php 211
$pre_wp_mail = apply_filters( 'pre_wp_mail', null, $atts );

Where in WP core the hook is used WordPress

Usage not found.