wp_mail_content_type
Дозволяє змінити тип контенту в листах, що надсилаються через wp_mail() . Наприклад з text/plain на text/html .
За умовчанням тип контенту WordPress дорівнює ‘text/plain’ .
Використання
add_filter( 'wp_mail_content_type', 'wp_kama_mail_content_type_filter' );
/**
* Function for `wp_mail_content_type` filter-hook.
*
* @param string $content_type Default wp_mail() content type.
*
* @return string
*/
function wp_kama_mail_content_type_filter( $content_type ){
// Filter...
return $content_type;
}- $content_type
(Рядок) Тип контенту
Може бути:
- text/plain
- text/html
- multipart/mixed
- і т.д.
Приклади
#1 Змінимо тип контент листа
add_filter( 'wp_mail_content_type', 'get_content_type' );
function get_content_type() {
return 'text/plain';
}
список змін
| З версії 2.3.0 | Введено. |
Де викликається хук
wp_mail_content_type
wp-includes/formatting.php 5984
$content_type = apply_filters( 'wp_mail_content_type', $content_type );
Де використовується хук у WordPress
Використання не знайдено.