pre_wp_mail WordPress Filter Hook

The pre_wp_mail hook is a hook that is called before the wp_mail() function is executed. This hook can be used to modify the email headers or to do any other processing that might need to be done before an email is sent.

apply_filters( 'pre_wp_mail', null|bool $return, array $atts ) #

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.


Top ↑

Parameters

$return

(null|bool)Short-circuit return value.

$atts

(array)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.


Top ↑

Source

File: wp-includes/pluggable.php

View on Trac



Top ↑

Changelog

Changelog
VersionDescription
5.7.0Introduced.

The content displayed on this page has been created in part by processing WordPress source code files which are made available under the GPLv2 (or a later version) license by theĀ Free Software Foundation. In addition to this, the content includes user-written examples and information. All material is subject to review and curation by the WPPaste.com community.

Show More