filtrod 2.2.0
wp_mail
Opis
Filtruje parametry wiadomości przed wysłaniem — tablicę z kluczami to, subject, message, headers i attachments.
Przykład użycia
add_filter( 'wp_mail', ... )php
add_filter( 'wp_mail', 'wpdocs_force_reply_to' );
function wpdocs_force_reply_to( $atts ) {
$atts['headers'][] = 'Reply-To: ' . get_bloginfo( 'admin_email' );
return $atts;
}
add_filter( 'wp_mail', 'wpdocs_force_reply_to' );
function wpdocs_force_reply_to( $atts ) {
$atts['headers'][] = 'Reply-To: ' . get_bloginfo( 'admin_email' );
return $atts;
}Parametry
| Parametr | Typ | Opis |
|---|---|---|
$args | array | { Array of the <code>wp_mail()</code> 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. } |
Wywołanie
Rejestracja callbackaphp
// rejestracja funkcji zwrotnej
add_filter( 'wp_mail', 'twoja_funkcja' );
function twoja_funkcja($param_1) {
// Twój kod
}
// rejestracja funkcji zwrotnej
add_filter( 'wp_mail', 'twoja_funkcja' );
function twoja_funkcja($param_1) {
// Twój kod
}Popularne w tej kategorii