WP Gravity Forms Change error message text | Double Marvellous
Back to Blog
Development Oct 14, 2024 4 min read

WP Gravity Forms Change error message text

WP Gravity Forms Change error message text

I was recently tasked with changing some Gravity Forms content over to a different language. I have to say, it was a little odd.

Gravity Forms uses hooks to update certain core parts, seemingly. So you can’t just change the error message in the form settings itself.

So here’s what you do:

Firstly, get access to your functions.php file or use a plugin (such as Snippets – if you are unfamiliar I would recommend this plugin as it saves you from killing your site with errors in the functions file).

Next, get the ID of your form. It’s listed when you view all forms. My form ID is 2

Then add the ID to the end of the filter name, like this: gform_validation_message_2

Finally, use the filter below, making sure to use the correct ID in the first line. This way you will target just the form you are looking to target

Okay hope that helps someone!

add_filter("gform_validation_message_2", "change_message", 10, 2);
function change_message($message, $form){
  return "<div class='validation_error'>This is your new error message</div>";
}

Double Marvellous

AI Chatbot

Double Marvellous.