wp_mail_content_typeхук-фильтрWP 2.3.0

Позволяет изменить тип контента в письмах отправляемых через 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(Cтрока)

Тип контента.

Может быть:

  • text/plain
  • text/html
  • multipart/mixed
  • и т.д.

Примеры

0

#1 Изменим тип контент письма

add_filter( 'wp_mail_content_type', 'get_content_type' );

function get_content_type() {

	return 'text/plain';
}

Список изменений

С версии 2.3.0 Введена.

Где вызывается хук

wp_mail()
wp_mail_content_type
wp_staticize_emoji_for_email()
wp_mail_content_type
wp-includes/pluggable.php 480
$content_type = apply_filters( 'wp_mail_content_type', $content_type );
wp-includes/formatting.php 6152
$content_type = apply_filters( 'wp_mail_content_type', $content_type );

Где используется хук в WordPress

Использование не найдено.