Created
October 14, 2019 06:57
-
-
Save New0/81fc55dde63d8a89d32615230858c16f to your computer and use it in GitHub Desktop.
Set custom error messages during custom Caldera Forms process
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 | |
//Unset success message and set a different error message for admin users and others | |
add_filter('caldera_forms_render_notices', function ($notices) { | |
//Unset success message | |
unset($notices['success']['note']); | |
//Set error message for admins | |
if ( current_user_can('administrator') ) { | |
$notices['error']['note'] = __('Submission error. The precise error is ...', 'caldera-forms'); | |
} else { | |
$notices['error']['note'] = __('Submission failed. Try again or contact site owner.', 'caldera-forms'); | |
} | |
return $notices; | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment