Last active
January 31, 2022 18:07
-
-
Save sc0ttkclark/7297d8e8a41a2ac2309af778364e86da to your computer and use it in GitHub Desktop.
This recipe will disable the HTML removal from email templates when using unsupported tags.
This file contains hidden or 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 line. | |
/** | |
* This recipe will disable the HTML removal from email templates when using unsupported tags. | |
* | |
* 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/ | |
*/ | |
add_filter( 'pmpro_kses', 'my_disable_pmpro_kses_for_email', 10, 3 ); | |
/** | |
* Disable pmpro_kses sanitization for the pmpro_email context. | |
* | |
* @param string $sanitized_string The sanitized string. | |
* @param string $original_string The original string. | |
* @param string $context The sanitization context. | |
* | |
* @return string The sanitized or original string depending on the context. | |
*/ | |
function my_disable_pmpro_kses_for_email( $sanitized_string, $original_string, $context ) { | |
// Only change if context is pmpro_email. | |
if ( 'pmpro_email' !== $context ) { | |
return $sanitized_string; | |
} | |
// Just return the original string and do not process it. | |
return $original_string; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment