Filter hook 'wp_mail_charset'

in WP Core File wp-includes/pluggable.php at line 502

View Source

wp_mail_charset

Filter Hook
Description
Filters the default wp_mail() charset.

Hook Information

File Location wp-includes/pluggable.php View on GitHub
Hook Type Filter
Line Number 502

Hook Parameters

Type Name Description
string $charset Default email charset.

Usage Examples

Basic Usage
<?php
// Hook into wp_mail_charset
add_filter('wp_mail_charset', 'my_custom_filter', 10, 1);

function my_custom_filter($charset) {
    // Your custom filtering logic here
    return $charset;
}

Source Code Context

wp-includes/pluggable.php:502 - How this hook is used in WordPress core
<?php
 497  		 *
 498  		 * @since 2.3.0
 499  		 *
 500  		 * @param string $charset Default email charset.
 501  		 */
 502  		$phpmailer->CharSet = apply_filters( 'wp_mail_charset', $charset );
 503  
 504  		// Set custom headers.
 505  		if ( ! empty( $headers ) ) {
 506  			foreach ( (array) $headers as $name => $content ) {
 507  				// Only add custom headers not added automatically by PHPMailer.

PHP Documentation

<?php
/**
		 * Filters the default wp_mail() charset.
		 *
		 * @since 2.3.0
		 *
		 * @param string $charset Default email charset.
		 */
Quick Info
  • Hook Type: Filter
  • Parameters: 1
  • File: wp-includes/pluggable.php
Related Hooks

Related hooks will be displayed here in future updates.