Created
May 2, 2021 04:35
-
-
Save kadimi/47a7de34efac91845fa07f3a7da41295 to your computer and use it in GitHub Desktop.
Allow curly brackets in Ninja Forms notifications.
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 | |
/** | |
* Allow text between brackets in Ninja Forms notifications. | |
* | |
* - How to Use: wrap the text you want to put inside curly brackets in double square brackets, e.g. `[[tag]]`. | |
* - Setup: Add this code to your website (I recommend using the plugin Code Snippets). | |
* | |
* @author Nabil @ REI Conversion | |
*/ | |
add_filter( 'ninja_forms_action_email_message', function($message) { | |
$replacements = [ | |
'[[' => '{', | |
']]' => '}', | |
]; | |
return str_replace( | |
array_keys( $replacements ), | |
array_values( $replacements ), | |
$message | |
); | |
} ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment