apply_filters( 'pre_wp_mail', null|bool $return, array $atts )
- Since
- 5.7.0, 6.9.0
Filters whether to preempt sending an email.
Description
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.
Compatibility
- WordPress
- since 6.9.0
- 6.7.7
- 6.8.8
- 6.9.7
- 7.0.4
- 7.1.0
Present in every tracked release (6.7.7 to 7.1.0).
Parameters
$returnnull|bool- Short-circuit return value.
$attsarray- { Array of the
wp_mail()arguments.
@type string|string[] $to Array or comma-separated list of email addresses to send message.
@type string $subject Email subject.
@type string $message Message contents.
@type string|string[] $headers Additional headers.
@type string|string[] $attachments Paths to files to attach.
@type string|string[] $embeds Paths to files to embed.
}$tostring|string[]Array or comma-separated list of email addresses to send message.$subjectstringEmail subject.$messagestringMessage contents.$headersstring|string[]Additional headers.$attachmentsstring|string[]Paths to files to attach.$embedsstring|string[]Paths to files to embed.
Where this hook fires · 1
wp-includes/pluggable.php:233wp_mail()
Source code
* @type string $message Message contents. * @type string|string[] $headers Additional headers. * @type string|string[] $attachments Paths to files to attach. * @type string|string[] $embeds Paths to files to embed. * } */ $pre_wp_mail = apply_filters( 'pre_wp_mail', null, $atts ); if ( null !== $pre_wp_mail ) { return $pre_wp_mail; } if ( isset( $atts['to'] ) ) {Changelog
Introduced in 5.7.0. Unchanged from 6.7.7 through 7.1.0.
Signature, return type and hooks compared across 5 parsed releases.
6.9.0
The
$embeds element was added to the $atts array.from the docblock5.7.0
Introduced.from the docblock
About this page
- Parsed data
- Generated from the wordpress-develop 7.1.0 tag, and regenerated for each WordPress release so it tracks the code rather than a snapshot of it.
- Corrections
- Something wrong on this page? Report it and it gets fixed in the next regeneration.