Skip to content

Instantly share code, notes, and snippets.

@New0
Created October 14, 2019 06:57
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save New0/81fc55dde63d8a89d32615230858c16f to your computer and use it in GitHub Desktop.
Save New0/81fc55dde63d8a89d32615230858c16f to your computer and use it in GitHub Desktop.
Set custom error messages during custom Caldera Forms process
<?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