pre_wp_mail
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', 'wp_kama_pre_wp_mail_filter', 10, 2 ); /** * Function for `pre_wp_mail` filter-hook. * * @param null|bool $return Short-circuit return value. * @param array $atts Array of the `wp_mail()` arguments. * * @return null|bool */ function wp_kama_pre_wp_mail_filter( $return, $atts ){ // filter... return $return; }
- $return(null|true|false)
- Short-circuit return value.
- $atts(массив)
Array of the wp_mail() arguments.
-
to(строка|string[])
Array or comma-separated list of email addresses to send message. -
subject(строка)
Email subject. -
message(строка)
Message contents. -
headers(строка|string[])
Additional headers. - attachments(строка|string[])
Paths to files to attach.
-
Список изменений
С версии 5.7.0 | Введена. |
Где вызывается хук
pre_wp_mail
wp-includes/pluggable.php 214
$pre_wp_mail = apply_filters( 'pre_wp_mail', null, $atts );