W3cubDocs

/WordPress

apply_filters( ‘wp_mail’, array $args )

Filters the wp_mail() arguments.

Parameters

$argsarray
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.

More Information

  • The wp_mail filter hook allows you to filter the arguments that are passed to the wp_mail() function. The arguments for wp_mail() are passed through the filter as an array.
  • $attachments should be an array. If it is not, it will be converted to one by the wp_mail function after the filter.

Source

$atts = apply_filters( 'wp_mail', compact( 'to', 'subject', 'message', 'headers', 'attachments' ) );

Changelog

Version Description
2.2.0 Introduced.

© 2003–2024 WordPress Foundation
Licensed under the GNU GPLv2+ License.
https://developer.wordpress.org/reference/hooks/wp_mail