Filter hook 'wp_mail_content_type'

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

View Source

wp_mail_content_type

Filter Hook
Description
Filters the wp_mail() content type.

Hook Information

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

Hook Parameters

Type Name Description
string $content_type Default wp_mail() content type.

Usage Examples

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

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

Source Code Context

wp-includes/pluggable.php:481 - How this hook is used in WordPress core
<?php
 476  		 *
 477  		 * @since 2.3.0
 478  		 *
 479  		 * @param string $content_type Default wp_mail() content type.
 480  		 */
 481  		$content_type = apply_filters( 'wp_mail_content_type', $content_type );
 482  
 483  		$phpmailer->ContentType = $content_type;
 484  
 485  		// Set whether it's plaintext, depending on $content_type.
 486  		if ( 'text/html' === $content_type ) {

PHP Documentation

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

Related hooks will be displayed here in future updates.