Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save kadimi/47a7de34efac91845fa07f3a7da41295 to your computer and use it in GitHub Desktop.
Save kadimi/47a7de34efac91845fa07f3a7da41295 to your computer and use it in GitHub Desktop.
Allow curly brackets in Ninja Forms notifications.
<?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