Created
June 27, 2023 08:26
-
-
Save ipokkel/75a69865ba79ab015a502e4b3aa9fbbd to your computer and use it in GitHub Desktop.
Replace double backslashes before apostrophe in the email From Name and replace apostrophe html code with an apostrophe in the sitename email placeholder variable.
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 | |
/** | |
* Fix apostrophe's used in the from name and sitename email variable in 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 pmpro_email_sender_name_remove_double_backslashes( $from_name ) { | |
return str_replace( '\\', '', $from_name ); | |
} | |
add_filter( 'pmpro_email_sender_name', 'pmpro_email_sender_name_remove_double_backslashes' ); | |
function pmpro_email_data_sitename_replace_apostrophe( $data ) { | |
$data['sitename'] = str_replace( ''', "'", $data['sitename'] ); | |
return $data; | |
} | |
add_filter( 'pmpro_email_data', 'pmpro_email_data_sitename_replace_apostrophe' ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment