Last active
August 7, 2023 14:39
-
-
Save JarrydLong/43263034adb88b568e7f64f48a3da910 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php //do not copy | |
/** | |
* This recipe removes the HTML content type and adds a plain text content type for all PMPro emails | |
* | |
* You can add this recipe to your site by creating a custom plugin | |
* or using the Code Snippets plugin available for free in the WordPress repository. | |
* Read this companion article for step-by-step directions on either method. | |
* https://www.paidmembershipspro.com/create-a-plugin-for-pmpro-customizations/ | |
*/ | |
function my_pmpro_email_headers( $headers, $email ) { | |
$new_headers = array(); | |
foreach( $headers as $key => $header ) { | |
//Only use the headers that don't reference the content type | |
if ( strpos( $header, "text/html" ) === false ) { | |
$new_headers[] = $header; | |
} | |
} | |
//Set to plain text | |
$new_headers[] = "Content-Type: text/plain"; | |
return $new_headers; | |
} | |
add_filter( "pmpro_email_headers", "my_pmpro_email_headers", 10, 2 ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment